From: Robert Klemme Date: 2005-04-22T00:24:31+09:00 Subject: Re: accessor for Class Variable "Leonardo Francalanci" schrieb im Newsbeitrag news:4267B7A4.6060708@simtel.it... > > class< > > Aaargh... what is that? What does it mean? > Sorry, I'm coming from Java... Then you'll never know... *evil grin* Ok, class << x ... end is the singleton class of that instance. You can use that to define methods for a certain instance only (in this case it's the class). Some examples: 17:20:35 [robert.klemme]: irb irb(main):001:0> obj = Object.new => # irb(main):002:0> def obj.foo() "foo" end => nil irb(main):003:0> obj.foo => "foo" irb(main):004:0> class < def bar() "<<" + foo() + ">>" end irb(main):006:1> end => nil irb(main):007:0> obj.bar => "<>" As a class is an object much like every other object, you can also define singleton methods for them: irb(main):008:0> def String.foo() "foo" end => nil irb(main):009:0> String.foo => "foo" irb(main):010:0> class < def bar() "<<" + foo() + ">>" end irb(main):012:1> end => nil irb(main):013:0> String.bar => "<>" irb(main):014:0> Does that help? Kind regards robert