Adding aspects that modify return values?

M

Mario T. Lanza

I am trying to use 'aspectr' to add aspects to Rails FormHelpers like
'text_field'. I want the aspects to be able to intercept the return
value and modify it so that the original method call 'text_field'
returns the value that I modified in the aspect.

It appears to me that aspects do not allow return values to be modified.
Too bad. This would have perfectly met the need I am after. I want to
add extra markup surrounding the 'input' markup in order to standardize
my views in a DRY way.

I don't really want to fool with the original FormHelpers because I want
my add-on to be modular and separate. I considered inheriting to create
a new FormHelper, but thought better of it, since aspects seemed more
suited.

Am I wrong about aspects? Can they intercept and modify return values?
If not, what are the alternatives?

I am working on a library that will DRY up my presentation logic.
Eventually, if I can overcome these hurdles, I intend to open source the
library.

Thanks Much!
Mario T. Lanza
 
M

Mario T. Lanza

I could only find :before and :after points in AspectR. I am new to
aspects, so perhaps I have overlooked how it might be done in AspectR.
Nevertheless, your Aquarius gem looks promising. I'll give it a look.

Thank you!
Mario
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top