From: "Mario T. Lanza" Date: 2007-08-20T09:30:50+09:00 Subject: Show defining file for methods? 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. That is instead of: pp ActiveRecord.methods.sort .. "tainted?", "to_a", "to_json", .. We'd get something like: pp ActiveRecord.methods_with_origination_info.sort .. "tainted?" (/usr/lib/...), "to_a" (/some/path/to/this/file/...), "to_json" (/path/info/...), .. Even more useful if it could somehow tell me that it was included via a mixin or via inheritance, etc.: .. "to_a" (/some/path/to/this/file/...) mixed in from Array, "bogus_method" (/some/path/to/this/file/...) inherited from Bogus, .. Obviously, this is bogus sample info., however, it makes my point. This kind of information would make it easier to know where to go to look up documentation, especially during debugging/programming. Right now when listing all methods for an object or class, the list returned is overwhelming. I can't easily tell what methods are native and which ones got plastered on during a very dynamic load and from where they came. Or perhaps some other API is more desirable: #native_methods #mixed_in_methods #inherited_methods It would be useful to gather the same information about instance variables, though this is a lesser concern. I suspect this could be handled with either callbacks or aspect-oriented programming. I would also suppose this could be done by using "included_modules" or "ancestors" and accessing their methods to appropriately tag who owns what; however, I'm thinking this won't be exact as it should be possible during multiple mixins for a method to be overridden more than once. This would through into question ownership, that is unless the "included_modules" or "ancestors" returns the order of mixin. Also, this doesn't handle inheritance. Having this sort of information would be vastly helpful. The main drawback of Ruby is the lack of a power IDE that makes available just this sort of information. I know there are some that have come a long way (NetBeans??) but right now I basically use gedit and a terminal console. Any thoughts or guidance? Something I've overlooked? Thanks for any advice. Mario T. Lanza -- Posted via http://www.ruby-forum.com/.