>>>>> "F" == Ferenc Engard <ferenc / engard.hu> writes:

F> Sorry, I pushed "send" too early. That is not exactly what I want. I
F> want a method which will be called when an object is instantiated, if
F> the object's Class includes this Module. I.e., I do not want to write a
F> 'init_x_module' call into each classes' constructor, which includes this
F> module, but want the system call that method. Something like multiple
F> inheritance in C++.

 This ?

svg% cat b.rb
#!./ruby

module M
   def initialize#before
      puts "M#initialize#before"
   end
end

class A
   include M
end

A.new
svg%
 
svg% ./ruby b.rb
M#initialize#before
svg% 



p.s. : don't try it, this is a modified version of ruby which exist only at
moulon :-))


Guy Decoux