method_missing
shows up in Object.private_methods
, not in Object.public_methods
.
However, when I call Object.method_missing :stupidmethod
, I get
NoMethodError: undefined method `stupidmethod' for Object:Class
I would expect to get
NoMethodError: private method `method_missing' called for Object:Class
because that's what I get when I try to invoke Object
's other private methods, e.g. Object.chop
.
As more evidence, if I call Object.method_missing
without an argument, I get
ArgumentError: no id given
So it seems like I really am invoking that "private" method_missing
function from outside of its object. Can you explain this?
EDIT: Thank you to Eugene in the comments. ruby --version
tells me 1.8.7. Also, irb --version
is 0.9.5(05/04/13). Good to know that this behaves as I'd expect in the later versions.