From: Ammar Ali Date: 2010-10-15T04:08:08+09:00 Subject: Re: from a String. On Thu, Oct 14, 2010 at 9:27 PM, Josh Cheek wrote: > 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 > => "#" > Or, perhaps, marshal (http://ruby-doc.org/core/classes/Marshal.html) Regards, Ammar