Hi,
suppose I have 2 strings:
s1 = “hello”
s2 = “capitalize”
I want to do this:
m = s2.to_method
s1.m
=> “Hello”
I’m working on a Rails project where I want to call arbitrary methods of
a
model class.
At run-time …
I know how to get the names of the methods,
but can’t figure out how to call the corresponding methods.
How I convert string to method?
-Peter