From: Sebastian Hungerecker Date: 2007-09-06T02:24:12+09:00 Subject: Re: Method switching Lee Jarvis wrote: > 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) You could just redefine the method in question, like this: def color_off() def my_print(a) puts a end end def color_on() def my_print(a) puts colorize(a) end end def something() my_print "hello" end color_off() something() #no color color_on() something() #color HTH, Sebastian -- NP: Ulver - Dressed in Black Jabber: sepp2k@jabber.org ICQ: 205544826