Convert Hash to OpenStruct recursively : <p>Given I have this hash:</p>

<pre><code> h = { a: 'a', b: 'b', c: { d: 'd', e: 'e'} }
</code></pre>

<p>And I convert to OpenStruct:</p>

<pre><code>o = OpenStruct.new(h)
 =&gt; #&lt;OpenStruct a="a", b="b", c={:d=&gt;"d", :e=&gt;"e"}&gt; 
o.a
 =&gt; "a" 
o.b
 =&gt; "b" 
o.c
 =&gt; {:d=&gt;"d", :e=&gt;"e"} 
2.1.2 :006 &gt; o.c.d
NoMethodError: undefined method `d' for {:d=&gt;"d", :e=&gt;"e"}:Hash
</code></pre>

<p>I want all the nested keys to be methods as well. So I can access <code>d</code> as such:</p>

<pre><code>o.c.d
=&gt; "d"
</code></pre>

<p>How can I achieve this?</p>
