How to turn a string into a method call? [duplicate]

Object#send

>> a = "class"
>> "foo".send(a)
=> String

>> a = "reverse"
>> "foo".send(a)
=> "oof"

>> a = "something"
>> "foo".send(a)
NoMethodError: undefined method `something' for "foo":String

If you want to do a chain, can also use Object#eval

>> a  = "foo"
 => "foo" 
>> eval "a.reverse.upcase"
 => "OOF"