[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Removing "warning: method redefined"

Brian Takita

7/8/2005 7:29:00 AM

Hello,

What is the best way to remove "warning: method redefined" warnings?

Thank you,
Brian Takita

4 Answers

Yukihiro Matsumoto

7/8/2005 8:02:00 AM

0

Hi,

In message "Re: Removing "warning: method redefined""
on Fri, 8 Jul 2005 16:30:48 +0900, "Brian Takita" <brian.takita@gmail.com> writes:

|What is the best way to remove "warning: method redefined" warnings?

$VERBOSE=nil or remove method first by using remove_method.

matz.


Brian Takita

7/8/2005 3:48:00 PM

0

Thank you for your help.

I would like to keep the warnings on, so I don't see $VERBOSE=nil as a
viable option.

remove_method works for me except when I need to call the super method
in the new definition.

Is there another way to get rid of the warning or to use remove_method
and still be able to use the super method?

Yukihiro Matsumoto

7/8/2005 4:25:00 PM

0

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.


Brian Takita

7/8/2005 4:36:00 PM

0

Thank you for your clarification and correction.