[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

alias to module methods or class methods

Geert Fannes

4/4/2005 11:48:00 AM

Hello,

I tried to fix the Math.sqrt() domain error on windows I reported an
hour ago by redefining the Math.sqrt method:

module Math

alias sqrt_old sqrt

def Math.sqrt(x)

begin

Math.sqrt_old(x)

rescue Errno::EDOM

return 0.0/0.0

end

end

end



But this does not work. Apparently, I cannot create an alias to a module
method. I tested a bit and found out I could not create aliases to class
functions either. How can I create aliases to module methods and class
methods?



Greetings,

Geert.

PS:I found some confusing thread about creating class method aliases so
I ask it here again

1 Answer

dblack

4/4/2005 12:30:00 PM

0