On 5/16/07, edlich / gmail.com <edlich / gmail.com> wrote:
> 2. Can I modify the getter of any instance var?!
> -> E.g. if an attribute defines attr_accessor, can I change the getter
> at
> runtime to do magic aspect stuff around the real get call?

As Stefano said, you can modify the methods of a class in Ruby anytime you want.

irb> class Foo
irb>    attr_accessor :foo # here the conventional accessor is defined
irb>
irb*    def foo # and here it is overriden
irb>        puts "foo invoked"
irb>        @foo
irb>    end
irb> end
=> nil

irb> Foo.new.foo
foo invoked
=> nil