From: Zach Dennis Date: 2004-12-10T05:09:31+09:00 Subject: Re: Overloading a module method? Dominik Werder wrote: >> 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. module Math class << self alias :oldcos :cos end def Math::cos( val ) #etc... end end HTH, Zach