From: Brian Candler Date: 2003-07-19T01:34:59+09:00 Subject: Re: Aliased setter methods behave differently than other methods? On Sat, Jul 19, 2003 at 12:44:14AM +0900, Jim Cain wrote: > 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? irb(main):001:0> class Foo irb(main):002:1> def x=(a,b) irb(main):003:2> puts a,b irb(main):004:2> end irb(main):005:1> end => nil irb(main):006:0> a = Foo.new => # irb(main):007:0> a.x=(1,2) SyntaxError: compile error But: irb(main):008:0> a.send(:x=,1,2) 1 2 => nil Regards, Brian.