From: Daniel Schierbeck Date: 2006-06-11T21:42:13+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Yukihiro Matsumoto wrote: > Redundancy can be removed by some kind of meta programming. This could do the job: class Module def class_methods(&block) @class_methods = block end def included(mod) (class << mod; self; end).module_eval(&@class_methods) end end module Mod class_methods do def foo "FOO" end end def bar "BAR" end end class Test include Mod end Test.foo #=> "FOO" Test.new.bar #=> "BAR" Cheers, Daniel