From: Robert Klemme Date: 2006-03-20T17:48:49+09:00 Subject: Re: simple ruby language question Marcin Miel��y��ski wrote: > module A > def test > raise 'ARG' if !@blah > @blah > end > end > > class B > include A > > def initialize > @blah = 'YES!' > end > end > > b = B.new > p b.test You can even automate this with proper use of initializers: module A def initialize(*a,&b) super @blah = "set" end def test raise 'ARG' if !@blah @blah end end class B include A end class C include A def initialize(x) super() @another_member = x end end >> B.new.test => "set" >> C.new(1).test => "set" > Module#include will make module methods to become instance ones. > Object#extend adds methods to an instance (to the class B in this case, > you could say then B.test) Adding to that, usually the OP should decide whether to do one or another. Kind regards robert