From: Daniel Schierbeck Date: 2006-06-12T00:40:23+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? James Edward Gray II wrote: > Here's another idea: > > >> class Module > >> def included(receiver) > >> receiver.extend(const_get(:ClassMethods)) if const_defined? > :ClassMethods > >> end > >> end > => nil > >> module Test > >> module ClassMethods > >> def test > >> "I'm a class method." > >> end > >> end > >> def test > >> "I'm an instance method." > >> end > >> end > => nil > >> class MyTest > >> include Test > >> end I'm not too fond of the nested module approach -- I think it's cleaner to use a method. But that's a matter of opinion, of course. Daniel