On Jul 23, 2010, at 13:40 , Alan G. wrote:
I’m trying to debug a bug where I seem to have a class that has two defintions, the one I know of, and another one, somewhere, the one I’m getting when I attempt to use the class.
Given a class, is there a way to get name of the file in which it was defined?
Something like that?
Classes in ruby are “open”, which means that they can be extended at any
time. So there isn’t really a “definition” (at least, for a single
location) of a given class.
You also have the case where something isn’t opened to have stuff added
to it, but instead it can be extended by modules instead.
If you want, you can play with the reflective hooks in Module:
method_added, included, extended, etc.