title: Converting a multi-level hash into a single hash
body: <p>I have a source hash:</p>
  
  <pre><code>a = {'1' =&gt; 'A',
       '2' =&gt; 'B',
       '3' =&gt; 'C',
       '4' =&gt; { '5' =&gt; 'D', '6' =&gt; 'E', '7' =&gt; { '8' =&gt; 'F', '9' =&gt; 'G' }},
       '10' =&gt; {'11' =&gt; 'H'}}
  </code></pre>
  
  <p>I need to construct a method to make it a flat hash (single hash). The result should look like:</p>
  
  <pre><code>a = {'1' =&gt; 'A', '2' =&gt; 'B', '3' =&gt; 'C', '5' =&gt; 'D', '6' =&gt; 'E', '8' =&gt; 'F', '9' =&gt; 'G', '11' =&gt; 'H'}
  </code></pre>
  
  <p>I tried with <code>merge</code>, <code>deep_merge</code>, <code>each_with_object</code>, and <code>recursion</code>, but they did not give proper results.</p>
  
  <p>Appreciate any help.</p>