From: Steven Smolinski Date: 2003-02-07T11:55:40+09:00 Subject: Re: Private lvalue methods unusable? Gavin Sinclair wrote: > On Friday, February 7, 2003, 10:35:08 AM, Steven wrote: >> How do I call a private lvalue method? > Hmmm.... so self.dollars = 100 doesn't work, eh? Only answer I can > think of is > > self.send(:dollars=, 100) > > Beautiful, isn't it? ;) It's as ugly as sin, but it works as advertised. :-) > Actually, a better answer came to mind. Make :dollars= protected > instead of private. It works. That works also, but it changes the spec. So does redefining the method signature, like so: def dollars(aNumber). That also works, but changes the spec. I'll just have to put this down as a "gotcha" and carry on. Is there a list of places Ruby doesn't follow the least surprise principle? Thanks for the help, Steve -- Steven Smolinski => http://arbiter.ca/ GnuPG Public Key => http://arbiter.ca/steves_public_key.txt => or email me with 'auto-key' in the subject. Key Fingerprint => 08C8 6481 3A7B 2A1C 7C26 A5FC 1A1B 66AB F637 495D