From: Morton Goldberg Date: 2006-07-25T01:40:58+09:00 Subject: Re: Dumb question about assigments That is very strange code you've posted. I wonder what the original author intended? The only way I could get a two-argument writer method to run was as follows: #! /usr/bin/ruby -w class M attr_reader :m def initialize @m = [0, 0] end def m=(x, y) @m = [x, y] end end foo = M.new p foo.m => [0, 0] foo.send(:m=, 1, 2) p foo.m => [1, 2] ------- end of code -------- The above proves that a two-argument writer can be called (sort of), but it really doesn't cast any light on what it would be used for. I hope some wiser head will clarify this. Regards, Morton On Jul 24, 2006, at 11:07 AM, Andrew Huh? wrote: > Hi, I feel kind of dumb for asking this, but I can't honestly find the > answer anywere. > > I came across a attribute defined like: > class BlahBlah > def something=(x,y) > #code > end > end > > I tried to assign the values as: > BlahBlah.something=(5,10) > and > BlahBlah.something=5,10 > and > BlahBlah.something(5,10) > > but all give me a "1 for 2" argument error (except for the last which > don't work because something is not a method). > All examples I came across either used only one argument, or defined > something as a method (strip the =). > > How can I assign values to this tipe of attribute? > thanks > > -- > Posted via http://www.ruby-forum.com/. >