From: Josh Cheek Date: 2010-10-15T03:27:42+09:00 Subject: Re: from a String. --0016363b9f7e793b37049297dd90 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Oct 14, 2010 at 1:03 PM, Huw Taylor wrote: > If I were to have this: > > class Hew > def initialize(string) > @string = string > end > def other_method > end > end > > a = Hew.new("Broown Cew") > => # > > b = a.to_s > => "#" > > My question is: Is there anyway to get the class (and its info) from b > (i.e what is now a string)? > > I see that changing it to a string loses the @string = "Broown Cew" bit. > :/ > > -- > Posted via http://www.ruby-forum.com/. > > If I understand what you mean, then what you really want is the inspect method b = a.inspect => "#" --0016363b9f7e793b37049297dd90--