# Listing Object.methods

**URL:** <https://www.ruby-forum.com/t/listing-object-methods/98216>\
**Category:** Ruby\
**Created:** [January 28, 2006, 10:39am UTC](https://www.ruby-forum.com/t/listing-object-methods/98216 "2006-01-28T10:39:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 28, 2006, 10:39am UTC](https://www.ruby-forum.com/t/listing-object-methods/98216/1 "2006-01-28T10:39:41Z")

</div>

Hello,  
Tonight I was thinking that it would be handy to  
have a way to list all the methods in a class but  
not list any of the standard methods that it inherits  
from its parent object enless they have been added  
to by the class in question.

Something like this, but better.

`Foo.new.methods - Object.methods`

For example if Foo reimplenents .to\_s then I would like to know about  
it.

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 28, 2006, 10:54am UTC](https://www.ruby-forum.com/t/listing-object-methods/98216/2 "2006-01-28T10:54:45Z")

</div>

On 2006.01.28 18:39, Alex C. wrote:

> Hello,  
> Tonight I was thinking that it would be handy to  
> have a way to list all the methods in a class but  
> not list any of the standard methods that it inherits  
> from its parent object enless they have been added  
> to by the class in question.
> 
> Something like this, but better.
> 
> `Foo.new.methods - Object.methods`

As a workaround, you can do this:

class \<\< foo; self; end.instance\_methods false

> For example if Foo reimplenents .to\_s then I would like to know about it.
> 
> Alex C.

E

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 28, 2006, 5:15pm UTC](https://www.ruby-forum.com/t/listing-object-methods/98216/3 "2006-01-28T17:15:02Z")

</div>

On Jan 28, 2006, at 3:52 AM, Eero S. wrote:

> On 2006.01.28 18:39, Alex C. wrote:
> 
> > Something like this, but better.
> > 
> > `Foo.new.methods - Object.methods`
> 
> As a workaround, you can do this:
> 
> class \<\< foo; self; end.instance\_methods false

Do we really need a singleton class for that? I prefer:

self.class.instance\_methods(false)

James Edward G. II

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [January 28, 2006, 10:09pm UTC](https://www.ruby-forum.com/t/listing-object-methods/98216/4 "2006-01-28T22:09:35Z")

</div>

On 2006.01.29 01:13, James Edward G. II wrote:

> Do we really need a singleton class for that? I prefer:
> 
> self.class.instance\_methods(false)

Yep, otherwise singleton methods will not be included.

> James Edward G. II

E
