title: How to deep transform values on Ruby hash
body: <p>I have a hash which looks like this:</p>
  
  <pre><code>hash = {
    'key1' =&gt; ['value'],
    'key2' =&gt; {
      'sub1' =&gt; ['string'],
      'sub2' =&gt; ['string'],
    },
    'shippingInfo' =&gt; {
                     'shippingType' =&gt; ['Calculated'],
                  'shipToLocations' =&gt; ['Worldwide'],
                'expeditedShipping' =&gt; ['false'],
          'oneDayShippingAvailable' =&gt; ['false'],
                     'handlingTime' =&gt; ['3'],
      }
    }
  </code></pre>
  
  <p>I need to convert each value which is a single string inside an array so that it ends up like this:</p>
  
  <pre><code>hash = {
    'key1' =&gt;  'value' ,
    'key2' =&gt; {
      'sub1' =&gt; 'string' ,
      'sub2' =&gt; 'string' ,
    },
    'shippingInfo' =&gt; {
                     'shippingType' =&gt; 'Calculated' ,
                  'shipToLocations' =&gt; 'Worldwide' ,
                'expeditedShipping' =&gt; 'false' ,
          'oneDayShippingAvailable' =&gt; 'false' ,
                     'handlingTime' =&gt; '3' ,
      }
    }
  </code></pre>
  
  <p>I found this but couldn't get it work
  <a href="https://gist.github.com/chris/b4138603a8fe17e073c6bc073eb17785" rel="nofollow noreferrer">https://gist.github.com/chris/b4138603a8fe17e073c6bc073eb17785</a></p>