Yukihiro Matsumoto
7/8/2005 4:25:00 PM
Hi,
In message "Re: Removing "warning: method redefined""
on Sat, 9 Jul 2005 00:50:47 +0900, "Brian Takita" <brian.takita@gmail.com> writes:
|remove_method works for me except when I need to call the super method
|in the new definition.
warning and remove_method are not related with super. IIRC, warning
was caused when you replace an existing method without making any
alias to the original.
class Foo
def foo
p :foo
end
end
class Bar < Foo
def foo
end
# warning
def foo
end
# remove foo in Bar
remove_method :foo
# no warning
def foo
super # calls foo in Foo
end
end
Bar.new.foo
matz.