Dominik Werder
12/9/2004 7:20:00 PM
> I think what you want is to alias the old method. super takes you up
> the method lookup chain, whereas alias operates at the same level but
> moves laterally, so to speak.
>
> class << Math # operate on Math's singleton superclass
> alias :oldcos :cos
> def cos(val)
> # here, oldcos(val) will call the old cos
>
this works basically, thanks, but it has some limitations:
I can call the new method now with Math.cos, but: If an other script
includes Math, then not the modified proxy class will be included but the
original module, so I loose all the new stuff :( This is bad because I
dont really want to rewrite the other scripts.
Second, a minor issue compared to the first, is that I have to watch not
to load my code twice, otherwise I overwrite my alias and the original cos
is lost..
I try hard to figure out how to make it better, but it seems that I'm
stuck..
bye!
Dominik