From: "Iñaki Baz Castillo" Date: 2008-05-02T18:37:25+09:00 Subject: Re: How to exec a module method when "include Module" from a Class ? 2008/5/2, Sandro Paganotti : > 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 Great !!! I didn't know the meaning of "included" class method of Module. Very useful in conjunction with "class_eval" :) Thanks a lot. -- Iñaki Baz Castillo