title: Ruby turn values inside a hash into local variables
body: <p>Say I have this hash:</p>
  <pre><code>entry = {&quot;director&quot;=&gt;&quot;Chris Nolan&quot;, &quot;producer&quot;=&gt;&quot;Sum Duk&quot;, &quot;writer&quot;=&gt;&quot;Saad Bakk&quot;}
  </code></pre>
  <p>I want to extract each key into its own local variable with the associated value:</p>
  <pre><code>director = &quot;Chris Nolan&quot;
  producer = &quot;Sum Duk&quot;
  ...
  </code></pre>
  <p>By using a loop and not:</p>
  <pre><code>director = entry[&quot;director&quot;]
  </code></pre>
  <p>Since there are a lot of values and I don't want to do them individually.</p>
  <p>I found this which works almost perfectly except it creates an instance variable and I want a local variable, but <code>local_variable_set</code> doesn't exist for some reason.</p>
  <pre><code>entry.each_pair { |k, v| instance_variable_set(&quot;@#{k}&quot;, v) }
  </code></pre>
  <p>Is there a solution? Or failing that, a way to turn an instance variable into a local one and delete the instance one without doing it one by one?</p>