On Sat, 14 Oct 2006, clintpachl wrote:
t = Test.new
Why doesn’t the first puts output ‘test_x_instance’? I would think that
the self.x call in the writer would call the reader.
This just came up today on IRC. I’d forgotten about it, but was
The writer method allows you to use the assignment-like syntax:
t.x = value
Since the goal of this is to make the method call look and feel more
assignment-like, and assignments return their right-hand side, the
writer-method calls also return their right-hand side, rather than the
last value in the method.
How can one call the reader from the writer method?
You are calling the reader, but the magic rhs value overrides it. I
haven’t found any way to circumvent it.