I've been doing some unit tests with ruby -W. Wow did I have a lot to
clean up but I still can't get past one warning. I've boiled it down
to this example:
o = Object.new
def o.foo
'foo'
end
class << o
undef_method :foo
end
def o.foo
'foo'
end
# undef_method_test.rb:8: warning: redefine foo
Is my head broken or ruby -W broken? I'm thinking the former.
Mayby it's the way undef_method works. I never looked at the internals but maybe the knowledge is kept somewhere that foo was defined at some point in time.
Kind regards
robert
···
_ugly <mgarriss@gmail.com> wrote:
I've been doing some unit tests with ruby -W. Wow did I have a lot to
clean up but I still can't get past one warning. I've boiled it down
to this example:
o = Object.new
def o.foo
'foo'
end
class << o
undef_method :foo
end
def o.foo
'foo'
end
# undef_method_test.rb:8: warning: redefine foo
Is my head broken or ruby -W broken? I'm thinking the former.