# About singleton\_methods

**URL:** <https://www.ruby-forum.com/t/about-singleton-methods/157182>\
**Category:** Ruby\
**Created:** [January 8, 2009, 8:30am UTC](https://www.ruby-forum.com/t/about-singleton-methods/157182 "2009-01-08T08:30:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyung\_won\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/47e85d/32.png) [@Kyung\_won\_C](https://www.ruby-forum.com/u/Kyung_won_C)\
**Post date:** [January 8, 2009, 8:30am UTC](https://www.ruby-forum.com/t/about-singleton-methods/157182/1 "2009-01-08T08:30:06Z")

</div>

class A  
class \<\< A  
def aaa  
end

```
protected
def bbb
end

private
def ccc
end

```

end  
end

p A.singleton\_methods # =\> [“aaa”, “bbb”]

# private method is not a singleton method… Why?

# Anyway ‘ccc’ is defined in a singleton class of A ?

###############

# Help Me^^

###############

---

<div class="post-metadata">

**Author:** ![Kyung\_won\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/47e85d/32.png) [@Kyung\_won\_C](https://www.ruby-forum.com/u/Kyung_won_C)\
**Post date:** [January 8, 2009, 10:06am UTC](https://www.ruby-forum.com/t/about-singleton-methods/157182/2 "2009-01-08T10:06:16Z")

</div>

On Thu, Jan 8, 2009 at 8:29 AM, Kyung won Cheon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> def ccc
> 
> # Help Me^^
> 
> ## ###############
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

I have never noticed that before, I certainly do not like that.

If you need that information you could do the following

class Object  
def my\_sing\_methods # this does not sing  
singleton\_methods + begin  
class \<\< self; self end.private\_instance\_methods( false )  
rescue  
[]  
end  
end  
end

This however gives you three more methods, namely :inherited,  
:initialize, :initialize\_copy.  
You can of course get rid of them, but what if they are overloaded?  
Unfortunately I can not  
think of any simple code to cover that.

Cheers  
Robert
