We recently had a problem where, after a series of commits had occurred, a backend process failed to run. Now, we were good little boys and girls and ran rake test after every check-in but due to some oddities in Rails' library loading, it only occurred when you ran it directly from mongrel in production mode.
Tracked the bug down and it was due to a new Rails gem overwriting a method in the String class in a way that broke one narrow use in runtime Rails code.
Anyway, long story short -- is there a way to, at runtime, ask Ruby where a method has been defined? Something like whereami( :foo ) that returned /path/to/some/file.rb line #45 (in this case, telling me that is was defined in class String would be unhelpful, because it was overloaded by some library) ? I cannot guarantee the source lives in my project, so grepping for 'def foo' won't necessarily give me what I need (not to mention if I have many def foo's, sometimes I don't know until runtime which one I may be using).
Thanks!!