From: Carlos Date: 2004-03-09T00:02:13+09:00 Subject: Re: proposal: class<, 2004-03-08 04.24 CET] [...] > Sorry.. this doesn't work in the following example. > I have tried with instance_eval, but no luck either. > > server> ruby a.rb > a.rb:9: undefined local variable or method `init' for #> (NameError) > server> expand -t2 a.rb > obj = "text" > class << obj > def init > @str = "hello" > end > def hello > puts @str > end > init > end > obj.hello > server> Maybe you should ask for a method #singleton for singleton classes, that returns the object... ;)