After that it will be quite difficult, but you can use the hook method to observe the line numbers where the method is defined.
class X < Object def X.method_added(symbol) puts "adding method #{symbol} to class X from #{caller(0)}" end end class X def a_method end end