A.new.test_go # does not call go=
A.new.go=3 # does call go=
But it seems like I never run into this problem...so...how does Ruby
*ever* call a local :method= type method, since they're always
ambiguous? Or are they?
Thanks!
-roger-
`go=3' is _always_ a local variable assignment. No way to prevent
that. What you can do is to tell Ruby the receiver:
def test_go
self.go=3
end
This forces Ruby to look up the #go= method on self directly,
bypassing the local variable guess.
Vale,
Marvin
···
Am 11.04.2012 20:01, schrieb Roger Pack:
Hello.
I am a bit confused.
With this class:
class A def go=(something) p 'in go=' end
def test_go go=3 end end
A.new.test_go # does not call go= A.new.go=3 # does call go=
But it seems like I never run into this problem...so...how does
Ruby *ever* call a local :method= type method, since they're
always ambiguous? Or are they? Thanks! -roger-