From: ts Date: 2004-02-27T20:32:40+09:00 Subject: Re: Callback >>>>> "I" == Ian Macdonald writes: I> Actually, I was looking forward to an answer to that question, because I> the same thing occurred to me, namely that the whole clause could be I> replaced by 'cb.class'. cb.class give the class of `cb' class << cb; self end give the singleton class associated with `cb' For example svg% cat b.rb #!/usr/bin/ruby cb = [] cb.class.instance_eval { define_method("aa") { p "nice method aa for Array" }} class << cb; self end.instance_eval do define_method("bb") { p "nice method bb for cb" } end cb.aa cb.bb [1].aa [1].bb svg% svg% b.rb "nice method aa for Array" "nice method bb for cb" "nice method aa for Array" ./b.rb:12: undefined method `bb' for [1]:Array (NoMethodError) svg% Guy Decoux