From: Roger Pack Date: 2008-08-27T12:11:11+09:00 Subject: Re: Is there a simple way to find a method definition? Ruby Freak wrote: > Is there a simple tool/procedure to find def mock_model ? (or def > some_method_name) There's a tool to determine some of the parameters: http://eigenclass.org/hiki/method+arguments+via+introspection or you could use ruby_parser if you wanted to extract info from the source :) There's also a tool to lookup using fastri [i.e. in irb] >> [].ri_find ——————————————————– Enumerable#find enum.detect(ifnone = nil) {| obj | block } => obj or nil enum.find(ifnone = nil) {| obj | block } => obj or nil ———————————————————————— Passes each entry in enum to block. Returns the first for which block is not false. If no object matches, calls ifnone and returns its result when it is specified, or returns nil (1..10).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> nil (1..100).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> 35 => nil http://betterlogic.com/roger/?p=327#comment-1058 Good luck. But then I have another question--isn't there a way to to inspect on a method signature and it says what line the method was defined on? -=R -- Posted via http://www.ruby-forum.com/.