From: "Jesús Gabriel y Galán" Date: 2011-01-18T03:08:11+09:00 Subject: Re: initialize() in a module, is it correct? On Mon, Jan 17, 2011 at 6:51 PM, Iñaki Baz Castillo wrote: > Hi, for some exotic reason I need to define initialize() method in a > module, so a class including such module can invoke super() in its > initialize() method. It seems to work: > > -------------------------------------------- > module M >  def initialize >    puts "I'm module M" >  end > end > > class A >  include M > >  def initialize >    puts "I'm class A instance" >    super >  end > end > > A.new > => I'm class A instance > => I'm module M > -------------------------------------------- > > However I would like to know if there could be an issue by using it. I don't think so. initialize it's just an instance method, just like any other, with the same lookup path: irb(main):001:0> module M irb(main):002:1> def test; puts "test from M"; end irb(main):003:1> end => nil irb(main):015:0> class A irb(main):016:1> include M irb(main):017:1> def test; puts "test from A"; super; end irb(main):018:1> end => nil irb(main):019:0> A.new.test test from A test from M Jesus.