I have the body of a ruby function as a string like
s = "x + 1"
I would like to do something like
fn = make_function(:x, s)
y = fn(10) # returns 11
What is the best way to achieve something like this?
Note that I’d rather not just keep eval’ing the string for each function call
This will eval the string once to define the function.
Here’s something like your desired
make_function