# \#instance\_methods on a singleton class

**URL:** <https://www.ruby-forum.com/t/instance-methods-on-a-singleton-class/185413>\
**Category:** Ruby\
**Created:** [March 19, 2010, 12:16pm UTC](https://www.ruby-forum.com/t/instance-methods-on-a-singleton-class/185413 "2010-03-19T12:16:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fxn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/77aa72/32.png) [@fxn](https://www.ruby-forum.com/u/fxn)\
**Post date:** [March 19, 2010, 12:16pm UTC](https://www.ruby-forum.com/t/instance-methods-on-a-singleton-class/185413/1 "2010-03-19T12:16:10Z")

</div>

Given:

```
class C
  def self.m; end
end
class D < C; end

```

the superclass of the singleton class of D is the singleton class of C.  
However

```
(class << D; self; end).instance_methods(false)

```

includes m, both in 1.8 and 1.9. Is that intentional or is it a bug?

---

<div class="post-metadata">

**Author:** ![fxn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/77aa72/32.png) [@fxn](https://www.ruby-forum.com/u/fxn)\
**Post date:** [March 20, 2010, 12:29am UTC](https://www.ruby-forum.com/t/instance-methods-on-a-singleton-class/185413/2 "2010-03-20T00:29:40Z")

</div>

On Fri, Mar 19, 2010 at 12:08 PM, Xavier N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Given:
> 
> Â Â class C  
> Â Â Â def self.m; end  
> Â Â end  
> Â Â class D \< C; end
> 
> the superclass of the singleton class of D is the singleton class of C.

Just a remark here. That’s what Flanagan & Matz says, but the draft of  
the spec says that the superclass of an eigenclass is implementation  
defined, and that the singleton class of D has the singleton class of  
C among its superclasses.

So the question still holds, either the spec is wrong, or there’s a  
bug I believe. Perhaps I should ask in -core.
