From: nobu.nokada@... Date: 2002-03-17T03:19:57+09:00 Subject: Re: Mixin class methods? Hi, At Sun, 17 Mar 2002 03:01:04 +0900, Chris Morris wrote: > Is it possible to define a method in a module so that when it's mixed in, it > becomes a class method? > > I tried something like this: > > module Mix > def inst_meth > puts 'inst_meth' > end > > class << self > def class_meth > puts 'class_meth' > end > end > end module Mix def inst_meth puts 'inst_meth' end module ClassMethods def class_meth puts 'class_meth' end end include ClassMethods def self.append_features(klass) super klass.extend(ClassMethods) end end -- Nobu Nakada