This works:

msg = :reverse
a = [1,2,3]
a.instance_eval(msg.to_s)


On Oct 24, 6:53 pm, Joel VanderWerf <v... / path.berkeley.edu> wrote:
> michele wrote:
> > So there is no need for "send"?One use of #send:
>
> a=[]
> @x=3
> a.send :<<, @x
> p a
>
> @x=4
> a.instance_eval{ self << @x }
> p a
>
> __END__
>
> Output:
>
> [3]
> [3, nil]
>
> This is because @x is in a different scope inside theinstance_evalblock.
>
> Another case, showing the real point of #send:
>
> msg = :reverse
> a = [1,2,3]
> b = a.send msg
> p b
>
> __END__
>
> Output:
>
> [3, 2, 1]
>
> There's no easy equivalent with #instance_evaland blocks (you could
> mess with strings, though).
>
> --
>        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407