Thursday, January 20, 2011

How can i know which method is called?

Web Application Testing in Ruby: Web Application Testing in Ruby: How to get frame name from Index

you send a message to an object, Ruby follows some path along
singleton object, class, included modules, superclasses, and so on.
Is there a way to know where the responding method is defined?

For example:

obj = MyClass.new
....
obj.f

The method f could be defined in MyClass or it could be just obj's
singleton method or whatever.
Is there a way to be sure of it?

I think I can find which class or module newly define a method.
But I don't know whether a method is redefined by a class or module

No comments:

Post a Comment