title: Ruby dot notation to nested hash keys
body: <p>What's the best way of converting a dot notation path (or even an array of strings) into a nested hash key-value? Ex: I need to convert <code>'foo.bar.baz'</code> equal to <code>'qux'</code> like this:</p>
  
  <pre><code>{
      'foo' =&gt; {
          'bar' =&gt; {
              'baz' =&gt; 'qux'
          }
      }
  }
  </code></pre>
  
  <p>I've done this in PHP, but I managed that by creating a key in the array and then setting a tmp variable to that array key's value by reference so any changes would also take place in the array.</p>