From: Sandro Paganotti Date: 2008-05-02T17:05:28+09:00 Subject: Re: How to exec a module method when "include Module" from a Class ? You can try overwrite initialize method from the module module M def self.included(classname) classname.class_eval <<-EOS alias_method :old_initialize, :initialize def initialize old_initialize module_method end EOS end def module_method @words << "module_word" end end class C attr_reader :words def initialize @words = [] @words << "class_word" end include M end Sandro www.railsonwave.com On Fri, May 2, 2008 at 7:32 AM, Iņaki Baz Castillo wrote: > 2008/5/1, Iņaki Baz Castillo : > > > > irb> c=C.new > > irb> c.words > > ["class_word", "module_word"] > > > > > > Is it possible without adding "module_method()" in class C initialize method? > > > Of course I could use inheritance and super method in "initialize()" > but in fact I need to include more than a module so inheritance > (single using "class < class") is not valid for me. > > > -- > Iņaki Baz Castillo > > -- Go outside! The graphics are amazing!