From: Trans Date: 2006-08-30T23:05:34+09:00 Subject: Re: Overriding Class Methods With Modules John W. Long wrote: > How do I override a class method on an object with another module? For > example: > > class TestObject > def self.my_method > "override me" > end > end > > module TestExtension > def my_method > "overridden by TestExtension" > end > def another_method > "another method" > end > end > > TestObject.extend TestExtension > > puts TestObject.my_method #=> "override me" > puts TestObject.another_method #=> "another method" > > Why can't I get TestObject to use my_method from TestExtension? Because we don't have Cuts ;-) Okay a more presently practical answer. You can use a hack like: module TestExtension def self.included(base) base.module_eval do def my_method "overridden by TestExtension" end end end def another_method "another method" end end T.