I have a setter function in a class that I would like to pass additional
arguments to, so I can do some addtional calculations if required.
My first crack at this was to do something like...
def variable=(value, options=nil)
@variable = value
do_something_cool if options == :flag
Here's the only problem, how do you pass the options?
object.variable = value, :flag
[value, :flag] being passed to the function.
I see a couple of work arounds.
1. send works, but is ugly object.send('variable=',value,:flag)
2. rewrite variable so that it expects an array and just unpack stuff
from the array
Any other solutions I may have overlooked?
Posted with http://DevLists.com. Sign up and save your mailbox.