# Is there a way to find the class methods of a class, just like 'methods' finds the instance methods?

**URL:** <https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552>\
**Category:** Ruby\
**Created:** [September 26, 2008, 5:58am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552 "2008-09-26T05:58:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [September 26, 2008, 5:58am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552/1 "2008-09-26T05:58:51Z")

</div>

The subject says it all, really.

Thanks,  
Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [September 26, 2008, 6:14am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552/2 "2008-09-26T06:14:39Z")

</div>

From: Kenneth McDonald [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

# Subject: Is there a way to find the class methods of a class,

# just like ‘methods’ finds the instance methods?

# The subject says it all, really.

singleton\_methods

---

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [September 26, 2008, 6:17am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552/3 "2008-09-26T06:17:35Z")

</div>

On Sep 25, 2008, at 9:56 PM, Kenneth McDonald wrote:

> The subject says it all, really.
> 
> Thanks,  
> Ken

p Class.methods

p File.methods

a @ [http://codeforpeople.com/](http://codeforpeople.com/)

---

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [September 26, 2008, 6:34am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552/4 "2008-09-26T06:34:32Z")

</div>

# 

# singleton\_methods

# 

also,

methods(false)

tend to always forget this, as false option is not documented in  
(fast)ri nor ruby-doc

i’m guessing stefan’s docu patch did not make it  
[http://groups.google.com/group/ruby-talk-google/browse\_thread/thread/9ab26673460e61c6](http://groups.google.com/group/ruby-talk-google/browse_thread/thread/9ab26673460e61c6)

using 1.8.7/1.9

---

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [September 26, 2008, 5:10pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552/5 "2008-09-26T17:10:40Z")

</div>

Thanks everyone. It appears, then, that Ncurses.init\_pair is not  
defined in the ncurses module,  
regardless of what the ruby cookbook says. Sigh.

Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [September 26, 2008, 9:59am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-find-the-class-methods-of-a-class-just-like-methods-finds-the-instance-methods/149552/6 "2008-09-26T09:59:02Z")

</div>

Kenneth McDonald wrote:

> Is there a way to find the class methods of a class, just like ‘methods’  
> finds the instance methods?

methods does not give you the instance methods of a class.  
instance\_methods  
does. obj.methods (where obj might very well be a class) gives you all  
the  
methods defined on obj, i.e. the instance methods of obj’s class (minus  
the  
ones you undefined for obj specifically, I suppose) + the singleton  
methods  
that are defined on obj directly. If you specify the argument false,  
only the  
singleton methods are listed.  
So SomeClass.methods will list all the instance methods of class Class +  
all  
the singleton (a.k.a. class-)methods of SomeClass and  
SomeClass.methods(false)  
will give you only the latter.

HTH,  
Sebastian
