From: Lloyd Zusman Date: 2005-02-06T11:52:57+09:00 Subject: Re: Module intercepts containing class's initialize method? Florian Gross writes: > Lloyd Zusman wrote: > >> class Bar >> include Intercept >> def initialize >> puts "performing Bar#initialize" >> end >> end >> >> In other words, simply by including the "Intercept" module in a class, >> I'd like to intercept that class's call to "initialize" and have the >> Intercept module's code get invoked first, and _then_ the containing >> class's "initialize" method should be called as it normally would. > > I think the only way of doing that without putting the include() behind > the initialize def would be using a method_added hook... Could you explain how this could be done with a method_added hook? > I'd also like there to be a better way of doing this and if I'm not > completely wrong and confusing things matz is already thinking about > this issue. Yes, that would be great. Thank you very much. -- Lloyd Zusman ljz@asfast.com God bless you.