From: Simon Strandgaard Date: 2004-03-04T23:59:42+09:00 Subject: Re: class< neither included nor extended works On Thu, 04 Mar 2004 15:47:08 +0100, Simon Strandgaard wrote: > On Thu, 04 Mar 2004 23:41:28 +0900, Carlos wrote: >>> I would like to execute some code at the point >>> when the 'class<> >> def txt.singleton_method_added(mthd) ... end >> >> is not exactly what you want, but close... > > Yes its close.. I wonder if there is anything closer? > > Otherwise I have place a compare inside 'singleton_method_added' > which checks if its first time we are being invoked. > Said so, done so... Its not pretty. I keep wondering why Module#extended isn't being invoked at this point? Perhaps an RCR will cut it ? :-) server> ruby b.rb singleton singleton_method_added server> cat b.rb txt = "text" class << txt alias old singleton_method_added def singleton_method_added(parent) puts "singleton #{parent}" alias singleton_method_added old undef old end def aa end def bb end end server> -- Simon Strandgaard