From: Chris Morris Date: 2002-03-17T03:31:05+09:00 Subject: RE: Mixin class methods? > module MixInst > def inst_meth > puts 'inst_meth' > end > end > > module MixCls > def class_meth > puts 'class_meth' > end > end > > class Test > include MixInst > Test.extend(MixCls) > end > > t = Test.new > t.inst_meth > Test.class_meth > > ... but now I've got two modules, and a less than clear way of mixing in. > Wonder if there's a way to get the above all in one module. It's a self-service email list for me today. Next time I'll hit Gooja *before* I post. # [ruby-talk:14976] module Mix def inst_meth puts 'inst_meth' end def Mix.append_features(includingClass) super def includingClass.class_meth puts 'class_meth' end end end class TestTwo include Mix end puts "TestTwo" t = TestTwo.new t.inst_meth TestTwo.class_meth This is cool stuff ... Chris