From: Roland Swingler Date: 2007-01-07T01:45:11+09:00 Subject: Re: Getting existing context when defining a singleton method (class << obj) Great! > Yes: Thanks for the (very speedy) response. > Hopefully there will be a method in Ruby 1.9/2.0 that will let you > grab an object's singleton class, so you could do: > > obj.singleton_class.class_eval # etc. I guess you can have this in ruby 1.8 by doing class Object def singleton_class class << self self end end end Some code that I've seen around is now much clearer... thanks again. Cheers, Roland