From: Daniel Schierbeck Date: 2006-06-12T19:19:10+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Gregory Seidman wrote: > Sure, I understand. And yes, that would fix it. Take a look at the complete > solution I posted at > http://redcorundum.blogspot.com/2006/06/mixing-in-class-methods.html Still think it's rather complicated. Here's what I've got so far, using a slightly different approach than you: class Module def meta_module(&block) @meta_module ||= Module.new @meta_module.module_eval(&block) extend(@meta_module) end def included(mod) mod.extend(@meta_module ||= Module.new) if mod.kind_of? Module if mod.instance_variables.include? "@meta_module" other_meta_module = mod.instance_variable_get(:@meta_module) other_meta_module.send(:include, @meta_module) else mod.instance_variable_set(:@meta_module, @meta_module) end end end end There may still be flaws, but I don't think it's too bad. Notice the use of `meta_module' -- thought it was better than `class_methods', though I'm not sure it's perfect, either. Cheers, Daniel