From: Daniel Brockman Date: 2005-07-04T04:06:20+09:00 Subject: Re: warning: refine foo, what!? "_ugly" writes: > class << o > undef_method :foo > end [...] > # undef_method_test.rb:8: warning: redefine foo > > Is my head broken or ruby -W broken? I'm thinking the former. It's not that simple, because `undef_method' doesn't remove methods; it overrides them with empty, or ``undefined'' ones. void rb_undef_method(klass, name) VALUE klass; const char *name; { rb_add_method(klass, rb_intern(name), 0, NOEX_UNDEF); } Thanks to that, you can do stuff like this: class Foo ; undef_method :dup end Foo.new.dup NoMethodError: undefined method `dup' for # I think you are looking for `remove_method'. $ ruby -W bar = Object.new def bar.foo ; end class << bar ; undef_method :foo end def bar.foo ; end -:4: warning: redefine foo $ ruby -W bar = Object.new def bar.foo ; end class << bar ; remove_method :foo end def bar.foo ; end -- Daniel Brockman So really, we all have to ask ourselves: Am I waiting for RMS to do this? --TTN.