Ticker

6/recent/ticker-posts

Object method call stack ruby

When a method is invoked (myobject.mymethod), Ruby first searches for the named method according to this search order:


Singleton methods in the receiver myobject.

Methods defined in myobject's class.

Methods defined among myobject's ancestors.

If the method mymethod is not found, Ruby searches for a default method called method_missing. If this method is defined, it is passed the name of the missing method (as a symbol) and all the parameters that were passed to the nonexistent mymethod.

Post a Comment

0 Comments