From: John Joyce Date: 2007-07-29T04:27:16+09:00 Subject: Re: Quarks On Jul 28, 2007, at 12:28 PM, Trans wrote: > > > On Jul 28, 9:41 am, John Joyce > wrote: >> >> Inheritance. >> Inherits from Object > > But the (false) parameter is supposed to limit it to just the class, > no ancestors. And it does mostly. But "mostly" is what doesn't make > sense. If you use (true) instead you get: > Check the docs again ri methods --------------------------------------------------------- Object#methods obj.methods => array ------------------------------------------------------------------------ Returns a list of the names of methods publicly accessible in _obj_. This will include all the methods accessible in _obj_'s ancestors. ri public_methods -------------------------------------------------- Object#public_methods obj.public_methods(all=true) => array ------------------------------------------------------------------------ Returns the list of public methods accessible to _obj_. If the _all_ parameter is set to +false+, only those methods in the receiver will be listed. So it matters what it means that "methods in the receiver" will be listed. some methods are built in to every object. You can make them private if you need to but then what good would they be? Sending .methods(false) will just give you an empty array. Not useful. Somethings to read about in ri : Object Kernel Singleton These classes are pretty important to understanding some of these aspects of the Ruby object model and inheritance. Read those carefully and it will be a little more clear.