Hi,

Am Donnerstag, 10. MÁ” 2005, 03:10:57 +0900 schrieb Joel VanderWerf:
> Bertram Scharpf wrote:
> >I want to understand thoroughly how singleton objects are
> >implemented. I try this:
> >
> >  class C ; end
> >
> >  puts C.inspect                       # =>  C
> >  puts class <<C ; self ; end.inspect  # =>  #<Class:C>
> 
> The second object is the metaclass of C. There's a good explanation of 
> metaclasses in the PickAxe book.

Ah, I see.

  class C ; def self.clsmeth() end end
    # => nil
  class <<C ; self ; end.instance_methods - Class.methods
    # => ["clsmeth"]

Thanks.

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de