Use "eval".

irb(main):001:0> def one
irb(main):002:1> puts "1"
irb(main):003:1> end
=> nil
irb(main):004:0> def two
irb(main):005:1> puts "2"
irb(main):006:1> end
=> nil
irb(main):007:0> metharray = ['one', 'two']
=> ["one", "two"]
irb(main):008:0> metharray.each { |e| eval e }
1
2
=> ["one", "two"]


On Tue, Feb 3, 2009 at 4:39 PM, Jason Shelton <jas.shelton / hotmail.com> wrote:
>
> Hello,
>
> I currently have an array of strings.  Let's say, for example, my array contains the following:
>
>                            ['one', 'two', 'three']
>
> Each element in my array is the name of a function in my program.  I wanto call the functions, using the array element.  So for example, lets say that my array is named 'numArray'.  I want to call the function in my program named 'one'.  I am now trying numArray[0].  Is there a way to make the numArray[0] be recognized as 'one' and call the function?  If my question isot clear, I can elaborate.  Thanks in advance for all help.
>
> - Shelton
> _________________________________________________________________
> Windows LiveHotmail(R):ę╬ore than just e-mail.
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009