C
clintpachl
class Test
def x
@x + '_instance'
end
def x=(v)
@x = v
self.x # also tried `x'
end
end
t = Test.new
puts t.x=('test_x')
=> test_x
puts t.x
=> test_x_instance
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.
How can one call the reader from the writer method?
-pachl
def x
@x + '_instance'
end
def x=(v)
@x = v
self.x # also tried `x'
end
end
t = Test.new
puts t.x=('test_x')
=> test_x
puts t.x
=> test_x_instance
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.
How can one call the reader from the writer method?
-pachl