From: Jim Cain Date: 2003-07-19T00:48:01+09:00 Subject: Re: Aliased setter methods behave differently than other methods? Jim Cain wrote: > Okay, this works fine now for setters: > > module_eval <<-EOF > def #{s}(arg) > puts 'hola ' + arg > self.old_#{s}(arg) > end > EOF > > But what about the generic case when you don't know how many arguments a > method takes, and you don't really want to know: > > module_eval <<-EOF > def #{s}(*arg) > puts 'hola ' + arg > self.old_#{s}(*arg) # syntax error > end > EOF > > I get a syntax error on the method call, but only for setters. Is a > method with a name like "somemethod=" required to take exactly one > argument? > > > Oops, sorry, I was too lazy to cut & paste. The last example should've been: module_eval <<-EOF def #{s}(*arg) puts 'hola ' + arg[0] self.old_#{s}(*arg) # syntax error end EOF But that of course does not address the syntax error on the old_ method call.