From: Fredrik Date: 2008-09-14T12:38:01+09:00 Subject: Re: Is my method defined? On Sep 13, 6:24 pm, Sebastian Hungerecker wrote: > Fredrik wrote: > > I have a method by the name methodA. I want to access this method like > > this > > > a = 'methodA' > > eval(a) > > You should use send if a only contains a methodname. > > > But how do I know if the variable a actually holds the name of a > > defined method? > > respond_to? method_name > > HTH, > Sebastian > -- > NP: Metallica - The Day That Never Comes > Jabber: sep...@jabber.org > ICQ: 205544826 Now I am utterly confused. Can anyone explain THIS behaviour : ### File : foo.rb ### def requiredfoo "I'm here!" end ##################### irb> require 'foo.rb' irb> respond_to? 'requiredfoo' => false irb> def foo ; "I'm here!" ; end irb> respond_to? 'foo' => true That doesn't make sense at all, right? /Fredrik