From: Daniel Schierbeck Date: 2005-11-24T05:22:25+09:00 Subject: Re: pattern: auto-running module init code Phil Tomson wrote: > I do kind of like your solution, but it does mean that the implementor of the > module needs to know to define an 'initialized' method to make the mechanism > work. That's no different from Module#included and Class.inherited. I think the method belongs in the module. > What if you just test for mod.respond_to? :initialize ? I suppose the > problem with that would be if the user of the module did happen to include > 'super' in their constructor - if they did then the module initialization > would be called twice. Yeah, and there would be the problem that multiple included modules would override each other's `initialize' methods (as would the including class.) Cheers, Daniel