In Ruby, you can do ...
Object.send(:public, *Object.private_instance_methods)
... as seen in this answer to another question. This redefines each of the private instance methods of Object
, making them public. My question is: how does this work? send
is supposed to work with the name of a method, but there do not seem to be methods named public
, private
, or protected
defined on Object
(or at least my search-fu has not found them).
> Object.respond_to?(:public)
=> false