Question : Variable Function Names in RUBY?  They exist in PHP and Perl

In perl and PHP there are variable variables and variable functions such that...

$func = 'foo';
$func();        // This calls foo()

$func = 'bar';
$func('test');  // This calls bar()

$func = 'echoit';
$func('test');  // This calls echoit()

Is there anything like this in Ruby / RubyOnRails?

Answer : Variable Function Names in RUBY?  They exist in PHP and Perl

No it is not.  I found the answer.... If anyone is looking for this functionality I recommend.


@my_function = "some_function"

my_object = SomeObject.new

my_object.send(@my_function)


Kernel.send works great (can only call public functions)
Random Solutions  
 
programming4us programming4us