Ruby convert string to method name
Try using "send".
methods.each do |method|
self.send(method, "abc")
end
All previous solutions with send
are fine but it is recommended to use public_send instead (otherwise you can be calling private methods).
Example:
'string'.public_send(:size)
=> 6
Best way is probably:
methods.each { |methodName| send(methodName, 'abc') }
See Object#send