Ruby on Rails
Monday, January 20, 2014
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 Dave Thomas with Chad Fowler and Andy Hunt. This problem was mentioned in page 129, but their explanation did not really make sense.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/85c3011c-787a-4894-bfe9-3add77d59925%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment