On Tue, 21 Mar 2006, Trans wrote: > Actually, I have developed what is probably the most complete solution > out there. Check out Calibre's > > require 'calibre/classinherit' > > Even so, any solution is still an ugly hack and imperfect to the real > solution. Hint. Hint. > i just use this pattern: harp:~ > cat a.rb module M module ClassMethods def foo; "foo"; end end module InstanceMethods def bar; "bar"; end end recursive_inclusion = lambda { |other| other.module_eval { extend ClassMethods include InstanceMethods singleton_class = class << self; self; end singleton_class.module_eval { define_method "included", &recursive_inclusion } super } } singleton_class = class << self; self; end singleton_class.module_eval { define_method "included", &recursive_inclusion } end class C include M end class B < C end module N include M end class D include N end p C::foo p C::new.bar p B::foo p B::new.bar p D::foo p D::new.bar harp:~ > ruby a.rb "foo" "bar" "foo" "bar" "foo" "bar" regards. -a -- share your knowledge. it's a way to achieve immortality. - h.h. the 14th dali lama