From: Gregory Brown Date: 2007-03-08T20:40:13+09:00 Subject: Re: How To Find The Name Of A Variable On 3/8/07, Andrew Stewart 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"]