Topic: Calling a method from a variable string?

Does anyone know how to call a method based on the contents of a string?

Something like:

def my_method_name
   puts "hello world"
end

string = "my_method_name"
string #=> "hello world"

Re: Calling a method from a variable string?

Try:

send(string.to_sym)

Railscasts - Free Ruby on Rails Screencasts

Re: Calling a method from a variable string?

Genious smile
Thanks worked great.