From: Paul Brannan Date: 2002-11-08T23:46:24+09:00 Subject: Re: v.polar = rho, theta On Fri, Nov 08, 2002 at 06:54:29AM +0900, Gennady F. Bystritsky wrote: > It does treat it the same way as multiple assignment to a variable - it > passes a single array argument. However initial example defined polar= as > accepting 2 arguments. That's why it did not work. Hmm, that makes sense. So: def polar=(x) raise ArgumentError if x.size != 2 @rho, @theta = *x end would work. The only thing I don't like about this is that the user has to explictly test the number of arguments that were passed in (something that it seems the interpreter should do for you). So the following would instead work: def polar=(x) set_polar(*x) end def set_polar(rho, theta) @rho = rho @theta = theta end but this requires a second method call. Are there any other options? Paul