On Tue, 09 Mar 2004 00:02:13 +0900, Carlos wrote:
[snip] 
> Maybe you should ask for a method #singleton for singleton classes,
> that returns the object... ;)

I tried poking around with 'singleton'.. but no luck.
Please give me some more hints.

;-)

server> ruby a.rb
#<Class:#<String:0x810a9b8>>
a.rb:7: warning: instance variable @str not initialized
nil
server> cat a.rb 
obj = "text"
class << obj
  def init
    @str = "hello"
  end
  def hello
    puts @str
  end
  p self
  #p self.methods
  #p self.singleton_methods
end
obj.hello
server>


--
Simon Strandgaard