From: Tuan Bui Date: 2003-07-15T05:32:39+09:00 Subject: Re: help - calling methods in a hash with parameters In case anyone wants to know of a solution, Lyle was kind enough to email me one: Lyle Johnson wrote: > Tuan Bui wrote: > >> If I want to create a hash table with the values containing methods to call, how do i call these methods if they need parameters? > > > Here's one alternative: > > myhash = { 'foo' => method('methodone'), > 'bar' => method('methodtwo') } > > myhash["foo"].call > myhash["bar"].call "hi, i am method two" > > The method() method returns a reference to a Method object for the named method (could I use the word "method" a few more times in that sentence?) And call() is an instance method for Method objects. > > Hope this helps, > > Lyle