Re: Dispatching when function name is stated as a symbol
- From: "Ronald Fischer" <ronald.fischer@xxxxxxxxxx>
- Date: Fri, 31 Aug 2007 17:48:07 +0900
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@xxxxxxxxxx>
Phone: +49-89-452133-162
.
- Follow-Ups:
- Re: Dispatching when function name is stated as a symbol
- From: Morton Goldberg
- Re: Dispatching when function name is stated as a symbol
- From: Rob Biedenharn
- Re: Dispatching when function name is stated as a symbol
- References:
- Dispatching when function name is stated as a symbol
- From: Ronald Fischer
- Re: Dispatching when function name is stated as a symbol
- From: Jesús Gabriel y Galán
- Dispatching when function name is stated as a symbol
- Prev by Date: Re: Dispatching when function name is stated as a symbol
- Next by Date: Re: 0.06 == 0.06 returns false in Ruby?
- Previous by thread: Re: Dispatching when function name is stated as a symbol
- Next by thread: Re: Dispatching when function name is stated as a symbol
- Index(es):