http://stackoverflow.com/questions/4664578/how-do-i-inspect-the-methods-of-a-ruby-object
http://stackoverflow.com/questions/3393096/how-can-i-get-source-code-of-a-method-dynamically-and-also-which-file-is-this-me
obj.class.instance_methods(false)
http://stackoverflow.com/questions/3393096/how-can-i-get-source-code-of-a-method-dynamically-and-also-which-file-is-this-me
Use source_location:
class A
def foo
end
endfile, line = A.instance_method(:foo).source_location
# or
file, line = A.new.method(:foo).source_location
puts "Method foo is defined in #{file}, line #{line}"
# => "Method foo is defined in temp.rb, line 2"