Gregory Seidman
8/20/2007 1:52:00 PM
On Mon, Aug 20, 2007 at 09:30:50AM +0900, Mario T. Lanza wrote:
> I don't think this is built in, but maybe I'm wrong. I was wondering
> how, if this isn't built in, we might add the ability when pretty
> printing a class/modules list of methods we might have the name of the
> file where the method was defined.
[...]
> Any thoughts or guidance? Something I've overlooked?
With a certain amount of work and hooking of Module::method_added,
Module::included, and Class::inherited you could probably get the
information you want. The base system, however, does not track that
information. Your hooks would have to gather the info and make it available
through some API, such as what you suggested. Also, if some piece of code
was a poor citizen and overrode one or more of your hooks without making
sure to call it (either with an alias chain or with super), you're out of
luck.
> Thanks for any advice.
> Mario T. Lanza
--Greg