From: Robert Klemme Date: 2012-04-17T05:25:45+09:00 Subject: Re: Operator overloading of the subscript operator On Mon, Apr 16, 2012 at 4:44 PM, Jan E. wrote: > Robert Klemme wrote in post #1056723: >> On Sat, Apr 14, 2012 at 5:03 PM, Jan E. wrote: >> >>> You won't find this in the Ruby API, because it's a core feature of the >>> language and not some special property of a method. >> >> Err, what? >> >> $ ri19 -T Array#[]= >> Array#[]= > > The OP asked about the assignment expression being interpreted as a > method call: > > Ralph Shnelvar wrote in post #1056479: >> That is, how would I come to know that >>   x.[]=(2, 'Tuesday') >> is equivalent to >>   x[2]='Tuesday' > > It wasn't about the built-in definitions of this method (which can of > course be looked up at ruby-doc.org or wherever -- but I'm sure the OP > already knew that). Hm, I would have understood it that way if the order was reversed, i.e. That is, how would I come to know that x[2]='Tuesday' is equivalent to x.[]=(2, 'Tuesday') because that would be the usual way of searching information, i.e. one sees x[2]='Tuesday' and wonders what it does. Anyway, apparently I misunderstood this part. Thanks for clarifying. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/