From: Sam Roberts Date: 2004-02-13T05:52:02+09:00 Subject: Re: Return value of foo= Quoteing matz@ruby-lang.org, on Fri, Feb 13, 2004 at 05:44:48AM +0900: > In message "Return value of foo=" > on 04/02/13, Gavin Kistner writes: > |The question is, is it possible to change the return value of a foo= > |method to NOT be the argument? > > The value of assignment is defined to be its right hand value, even > when it calls a method internally. You need to call "date=" method > explicitly to receive return value, e.g. > > puts t3.send(:date=, 11) Ok, now I'm the confused one... :-) Why does it not look like that in irb? [ensemble] ~/p/ruby $ irb irb(main):001:0> class Foo; def bar=(b); @bar = b; self; end; def bar; @bar; end; end nil irb(main):002:0> f = Foo.new # irb(main):003:0> f.bar = 9 # ^---- it looks like the value of the expression is "f", not "9". Is this just an oddity of irb? irb(main):004:0> f.bar 9 Thanks, Sam