<Elton Li>
Why does the following prints 4.0 but prints 60.0 when the statement in
durationInMinutes= is changed to
@duration = (value*60).to_i
or
self.duration = (value*60).to_i?
I thought it should print 60.0 in all three cases.
...
def durationInMinutes=(value)
duration = (value*60).to_i
end
...
</Elton Li>
Just a guess, but it looks like within an instance method the interpreter is
evaluating a 'symbol =' statement as an initializer for a temp variable and
never looks for the method. Not sure if this is intentional to allow
shadowing or if you've found an interesting bug.
Wayne