In mail "[ruby-talk:18837] Re: Get a list of class (not instance) functions"
"Florian G. Pflug" <fgp / phlo.org> wrote:
> > (class << some_class; self end).instance_methods
>
> It works.... but I'm not sure that I understand why. Please tell me if my
> assumptions are correct.
You are almostly right.
Things are documented at "Ruby's Class Hierarchy Chart" in object.c.
(Source code is a document In Ruby World... :)
> And why doens't Foo.class return the metaclass, just like foo.class returns
> Foo?
Because singleton methods are belong to object (not class),
at least in ruby philosophy. Singleton class statement is
the only place where metaclass appears directly.
Minero Aoki