In Ruby you can do ...
Object.send(:public, *Object.private_instance_methods)
... as seen in this answer to another question . This overrides each of the private instance methods Object
, making them publicly available. My question is: how does it work? send
should work with the method name, but it seems that there are no methods with the name public
, private
or protected
, defined on Object
(or at least my search fu hasn't found them).
> Object.respond_to?(:public)
=> false
source
share