From: Rajinder Yadav Date: 2009-10-07T11:43:34+09:00 Subject: Re: Does Ruby have a 'which' like method Scott G Smith wrote: > Most UNIX shells have a which command. > > It tells me the file which corresponds to a shell command. > > Demo: > which date > /bin/date > > In ruby, > Suppose I'm dealing with a String. > > This String has had some methods mixed-in. > > For example, > > s = 'hello' > p(s.length) > > Is there a way I can find the module or string.rb which defined the > length() method? > > I'd like it to work like this: > > p(s.which('length')) > /my/rubyfiles/string_module.rb you should be able to do the same thing using: http://www.railsapi.com make sure to select 'Rails v2.3.4 or Rails v2.3.4 + Ruby v1.9' before clicking on the 'Browse Online' otherwise you will get Rails APIs by default > > Thanks, > Scott > > -- Kind Regards, Rajinder Yadav http://DevMentor.org Do Good ~ Share Freely