R
Rick Tan
If i want to run a function whose name is contained in a string, how do
I do that in Ruby? or is this not feasible?
For example
def a
puts "a"
end
def b
puts "b"
end
mymethod="a"
In the above code snippet, i like to run the function a by using the
string mymethod. What trick if any can i use in ruby to make this
happen?
Thanks.
I do that in Ruby? or is this not feasible?
For example
def a
puts "a"
end
def b
puts "b"
end
mymethod="a"
In the above code snippet, i like to run the function a by using the
string mymethod. What trick if any can i use in ruby to make this
happen?
Thanks.