Consider using the #public_send method

Prefer the #public_send method to the #send method.

result_date = date.public_send(operation, delta)

In the example above the first parameter to the #public_send method is either “+” or “-“.

Written on March 17, 2016 by alistairmckinnell