From: James Edward Gray II Date: 2007-01-13T03:56:13+09:00 Subject: Re: Rake, Hoe, Meta-Programming, and Warnings (oh my!) On Jan 12, 2007, at 11:24 AM, Tim Pease wrote: > The warnings are coming from some meta-programming code that is > redefining instance methods on the fly based on user input. So maybe a > better question would be, is there a way to redefine methods without > causing Ruby to spew out a warning each time the method is redefined. Sure. Watch: #!/usr/bin/env ruby -w class Test def override "original" end end Test.new.override # => "original" class Test def override # !> method redefined; discarding old override "warning" end end Test.new.override # => "warning" class Test undef :override def override "no warning" end end Test.new.override # => "no warning" class Test alias_method :old_override, :override def override "alias avoids warning too" end end Test.new.override # => "alias avoids warning too" __END__ Hope that helps. James Edward Gray II