From: Marcin Grzywaczewski Date: 2007-09-06T02:18:25+09:00 Subject: Re: Method switching ------=_Part_25405_25636026.1189012703075 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2007/9/5, Lee Jarvis : > > Ok this probably won't make any send at all, but lets say i have > something like this: > > def send(a) > puts "#{a}\n" > end > > def colorsend(a) > puts "#{colorize(a)}\n" > end > > def something > send "hello" > end > > > > Ok lets say i have 50+ methods like the something method, that relate to > the send method, i want to be able to have 1 switch to change the method > without changing every method that uses send(message) > for example i could use > > if @color = 1 > colorsend(msg) > else > send(msg) > end > > but that means i would have to add that to *every* method.. if anyone at > all out there understands what i mean it would be very helpful > > thanks in advance.. > -- > Posted via http://www.ruby-forum.com/. > > Maybe you should do a exception which raises when @color = 1 and catch it and do in "catch" block a wrapper? Yours, Ravalas. ------=_Part_25405_25636026.1189012703075--