class ClassModule < Module undef_method :singleton_method_added end class Module # Be nice if this could be a constant instead. def ClassModule @_ClassModule_ ||= ::ClassModule.new end def singleton_method_added( m ) mod = self mod::ClassModule().module_eval { define_method( m, &mod.method(m) ) } end def inherit( mod ) include mod extend mod::ClassModule() end end #=begin test module M def self.hello ; "Hello" ; end def hello ; "hello" ; end end class X inherit M end p X.hello p X.new.hello module N inherit M end p X.hello p X.new.hello class Y inherit N end p Y.hello p Y.new.hello #=end