From: Ahmed Eldawy Date: 2009-11-25T18:56:55+09:00 Subject: Re: Detective - a new ruby gem Marcin Raczkowski wrote: > It's not using introspecition (like ruby2ruby) but simply finds a > declaration of function in file! > > So you get content of the function just like you written it, That's correct. It is not meant to be a kind of reverse-engineering. It relies on the fact that the source code is *somewhere* on your machine. It just finds it quickly and displays it to you. It needs to show the original code with its comments and indentation. This allows the developer to easily override a method or find bugs. > but unfrotunatelly, all metaprogramming is lost Not exactly. Methods overrided with a plugin or gem can still be shown correctly. There's an example of a method overrided and it shows the new code not the old one. Also there's another example with a method defined using define_method and it still gets the correct source code and its location. However, it cannot find methods defined in a string using eval() method. It will tell you "cannot find source code". It will not show you an incorrect or false code. Though, I think methods defined using eval scripts are very rare in the real world. Do you know famous examples for it? I'm thinking now of using introspecition with methods that I cannot find its source code. This will be some kind of plan B. I'll consider this in a future release. -- Posted via http://www.ruby-forum.com/.