From: Josh Cheek Date: 2011-08-19T15:59:15+09:00 Subject: Re: switch string to object --20cf307d04c65e129c04aad644c3 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Aug 19, 2011 at 1:52 AM, zuerrong wrote: > >> > > Objects are just things that can be assigned to variables -- you can also > > invoke methods on them, and they have classes. > > > > So strings, like nearly everything in Ruby, are objects. > > > > What are you expecting it to output? > > > > hello = "world" > puts "hello".to_object_variable > > will expect to print "world". > > Thanks. > > 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" --20cf307d04c65e129c04aad644c3--