How to know when an instance variable gets set in Ruby

Posted by Brian Genisio on Stack Overflow See other posts from Stack Overflow or by Brian Genisio
Published on 2010-04-18T02:39:23Z Indexed on 2010/04/18 2:43 UTC
Read the original article Hit count: 388

Filed under:

Is there any way to override the setting of instance variables in Ruby?

Lets say I set an instance variable:

@foo = "bar"

Can I intercept that and do something (like record it or puts, for instance)

© Stack Overflow or respective owner

Related posts about ruby