From: Gregory Brown Date: 2009-01-26T05:34:22+09:00 Subject: Re: unalias a method? On Sun, Jan 25, 2009 at 2:55 PM, Todd Burch wrote: > I'm assuming that alias_method is what I need to be using to temporarily > "redirect" all my Foo.hello calls to do something different for a > certain period of time, and finally I want to revert to the original > behavior of Foo.hello. > > I used a module example, because that's what I'm using my real case, and > I don't have access to the module source. Hopefully this does what you'd expect. -greg module Foo extend self def hello p "Hi" end end Foo.hello module Foo alias_method :old_hello, :hello def hello p "Hello again" end end Foo.hello module Foo alias_method :hello, :old_hello end Foo.hello -- Technical Blaag at: http://blog.majesticseacreature.com Non-tech stuff at: http://metametta.blogspot.com "Ruby Best Practices" Book now in O'Reilly Roughcuts: http://rubybestpractices.com