From: han.holl@... (Han Holl) Date: 2004-02-27T18:44:45+09:00 Subject: Re: Callback Pit Capitain wrote in message > Alternative 1: > self.class.send :define_method, name, proc { obj.keys } > > Alternative 2: > class << self; self; end.send :define_method, name, proc { obj.keys } > [ cut ] > Alternative 1 behaves more or less like your original version. The drawback of > both of them is that the method is defined in class A, but works only in one > instance of A. > > Alternative 2 defines the method only in the one instance passed to callback. > Thanks. This was what I wanted. In my case the class to add the 'cassette' method to is a singleton, so I guess alternative 1 would be the most efficient. Cheers, Han Holl