On 8/31/07, Jesù¸ Gabriel y GaláÏ <jgabrielygalan / gmail.com> wrote:
> On 8/31/07, Ronald Fischer <ronald.fischer / venyon.com> wrote:

> Would this work for you?
>
> def f(&cb)
>         x=cb.call
>         name = x[0]
>         args = x[1..-1]
>         send(name, *args);
> end
>
> def g1(a,b,c)
>         puts "g1: #{a}, #{b}, #{c}"
> end
>
> def g2(d,e)
>         puts "g1: #{a}, #{b}, #{c}"

Oooops, typo. That should of course read:

puts "g2: #{a}, #{b}, #{c}"

> end
>
> irb(main):017:0> f {[:g1, 1, 2, 3]}
> g1: 1, 2, 3
> => nil
> irb(main):018:0> f {[:g2, 1, 2, 3]}
> g2: 1, 2, 3
> => nil
>
> Hope this helps,
>
> Jesus.
>