--0016e65a0b6ce14f7a049f560bcc
Content-Type: text/plain; charset=UTF-8

On Fri, Mar 25, 2011 at 12:52 PM, Robert Dober <robert.dober / gmail.com>wrote:

> Now if you were looking for a way to get from a singleton class of an
> object to the object itself, I am not sure that this is possible.
>

This should do the trick:

>> s  "
""
>> class << s
>> def test
>> 1
>> end
>> end
nil
>> s.test
1
>> meta  class << s; self; end)
#<Class:#<String:0x83c87ac>>
>> ObjectSpace.each_object(meta).to_a
[""]
>> _.first.object_id
69092310
>> s.object_id
69092310

--0016e65a0b6ce14f7a049f560bcc--