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.
0 Comments