On 3/8/07, Andrew Stewart <boss / airbladesoftware.com> wrote:
> Hello,
>
> I'm wondering how I can ask a variable what its name is, so that I
> can convert it into a symbol.
>
> For example, I'd like to convert @bar to :bar.

You can't.  Variables aren't objects in Ruby.  However, if you post a
bit of context of the actual problem, I bet folks here will be able to
help you solve it.

You *can* get the listing of variables though:
>> @foo = 10
=> 10
>> instance_variables
=> ["@foo"]
>> a = 3
=> 3
>> local_variables
=> ["_", "__", "a"]