From: Josh Cheek Date: 2011-08-19T16:20:55+09:00 Subject: Re: switch string to object --bcaec54859d2dade8504aad691d8 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Aug 19, 2011 at 2:03 AM, zuerrong wrote: > 2011/8/19 Josh Cheek : > > > > > hello, in this case, is a variable. Notice that you cannot assign > `hello`, > > *itself* to a variable. Only the object that `hello` is pointing to (the > > string `"world"`) > > > > Anywhere you use hello, it will be implicitly dereferenced. It is the > same > > as using the object that it is pointing to. So that means you simply need > to > > do `puts hello` and it will print "world" > > > > > So, no way to translate a string to a variable name? Thanks. > > If you need this feature, there is probably a better way to do whatever it is you're trying to do. And just thinking about what you might be trying to do that could require such a feature implies that the better way is probably to use a hash table. If you aren't familiar with hashes, RKS has an introduction in session 3 ( http://ruby-kickstart.com/#session3) --bcaec54859d2dade8504aad691d8--