On Fri, Jun 25, 2010 at 6:11 AM, Manoj Kumar <manojs.nitt / gmail.com> wrote:
> Can we see the singleton class as object in ruby.

Like this?

irb(main):001:0> o = Object.new
=> #<Object:0xb743f3fc>
irb(main):002:0> singleton = class << o; self; end
=> #<Class:#<Object:0xb743f3fc>>
irb(main):003:0> singleton
=> #<Class:#<Object:0xb743f3fc>>
irb(main):004:0> def o.test; "test"; end
=> nil
irb(main):008:0> singleton.instance_methods(false)
=> ["test"]

Jesus.