From: Jan Date: 2009-11-21T23:27:40+09:00 Subject: Re: [ANN] Detective - a new ruby gem --0016e6d7ef6209b02f0478e24dc0 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Nov 21, 2009 at 9:42 PM, Ahmed Eldawy wrote: > Detective is a new gem build by BadrIT (www.badrit.com) to investigate > the ruby source code. > > Example > View the source of a class method ... > > require 'detective' > > Detective.view_source('ActiveRecord::Base.find_by_sql') > > Result > > def find_by_sql(sql) > connection.select_all(sanitize_sql(sql), "#{name} Load")ollect! > { |record| instantiate(record) } > end > > Interesting - just got a problem when have fun with it in irb: I have a simple hello.rb: class Foo def bar puts "hey" end end in irb: >> require 'hello' => true >> require 'detective' => true >> Detective.view_source "Foo#bar" => " def bar\n puts "hey"\n end\n" >> class Foo >> def bar >> puts "changed" >> end >> end => nil >> Detective.view_source "Foo#bar" => "Cannot find source code" >> Foo.new.bar changed A bug or I did something wrong? Thanks, Jan Detective is hosted on gemcutter > [sudo] gem install detective > > More examples and details on Detective homepage > http://github.com/aseldawy/detective > -- > Posted via http://www.ruby-forum.com/. > > --0016e6d7ef6209b02f0478e24dc0--