Hello Everyone,
Why does this function behave this way?
class Confuse
def confusion=(obj)
@obj = obj
return 'expected answer'
end
end
c = Confuse.new
c.confusion = 'this should be wrong'
This returns 'this should be wrong'.
I am reading *Programming Ruby 1.9 2.0* by
On Mon, Jan 20, 2014 at 1:30 PM, Peter pe...@poproj.com wrote:
class Confuse
def confusion=(obj)
@obj = obj
return 'expected answer'
end
end
c = Confuse.new
c.confusion = 'this should be wrong'
This returns 'this should be wrong'.
Ruby setters always ignore your explicit
2 matches
Mail list logo