I have a variable which reference a method, I call the method with the eval keyword
a_test = "myvariable"
eval a_test
def myvariable
(...)
end
I would like to pass a variable to method, such as
def myvariable(var1)
(...)
end
Is anyone familiar with any “idiom” way of accomplishing this. Doing something like
eval a_test "string_test"
will naturally fail since a lookup will be done by the interpreter for a function called “a_test”
This should work for you
In ruby though, it would be more appropriate to do something like this
Read more about
send