There is chapter from a well respected Ruby book I’ll see if I can post the link to.
ADD: I believe it is “Ruby Best Practices” pg 68.
(… link is in my Ruby Resources book list.)
But if I remember correctly you do as you have done, when your override does not handle the situation then you pass it along to the normal definition of method_missing
which is usually the default defined in BasicObject
. (Note that the example in the Ruby docs is poorly written in this respect.)
Re, your snippet. Seems like it would not work because it would only get called if MyModule
did not respond to the method, yet then the if
clause calls the missing method.