Dynamic Monkey patching of getter / setter methods?

Hello folks,

I’m playing around with dynamic monkey-patching of methods. However, I
run into syntax errors of my generated code:
ruby monkey.rb
Two: unpatched

Patched test_two called
Two: patched
monkey.rb:12:in catch_method': (eval):4:in catch_method’: compile
error (SyntaxError)
(eval):3: syntax error, unexpected ‘,’, expecting ‘=’
old_test_attribute=(*args,&block)
^
from monkey.rb:33

Do you know a way for dynamic monkey-patching of getter / setter
methods?

(source at: http://pastie.org/1132204)

Thanks,
Keep smiling
yanosz

Jan L. wrote:

Do you know a way for dynamic monkey-patching of getter / setter
methods?

Try using send:

send(:foo=, *args, &block)

Hello,

Am 01.09.10 22:10, schrieb Brian C.:

Jan L. wrote:

Do you know a way for dynamic monkey-patching of getter / setter
methods?

Try using send:

send(:foo=, *args,&block)

thanks - missed that one :wink:

Keep smiling
yanosz