On Aug 31, 2007, at 4:48 AM, Ronald Fischer wrote:
>>> Hence, if
>>>   x=cb.call
>>> causes x to contain [:g2, 25, 'dummy'], I would like to execute
>>>   g2(25,'dummy')
>>>
>>> I have not found a convincing way of doing this.
>>
>> Would this work for you?
>>
>> def f(&cb)
>> 	x=cb.call
>> 	name = x[0]
>> 	args = x[1..-1]
>> 	send(name, *args);
>> end
>
> Thank you! Works like a charm!
>
> Ronald
>
> --  
> Ronald Fischer <ronald.fischer / venyon.com>
> Phone: +49-89-452133-162

Why bother to split the name out of the array?  Just do:

send(*x)

If you really wanted to separate the name from the rest of the args,  
it might be more efficient (guessing, not benchmarked!) to say:

name = x.shift
send(name, *x)

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com