Ruby Convert String to Hash
<p>I'm storing configuration data in hashes written in flat files. I want to import the hashes into my Class so that I can invoke corresponding methods.</p>

<p>example.rb</p>

<pre><code>{ 
  :test1 =&gt; { :url =&gt; 'http://www.google.com' }, 
  :test2 =&gt; {
    { :title =&gt; 'This' } =&gt; {:failure =&gt; 'sendemal'}
  }
}
</code></pre>

<p>simpleclass.rb</p>

<pre><code>class Simple
  def initialize(file_name)
    # Parse the hash
    file = File.open(file_name, "r")
    @data = file.read
    file.close
  end

  def print
    @data
  end

a = Simple.new("simpleexample.rb")
b = a.print
puts b.class   # =&gt; String
</code></pre>

<p>How do I convert any "Hashified" String into an actual Hash?</p>