title: Ruby Metaprogramming: dynamic instance variable names
body: <p>Let's say I have the following hash:</p>
  
  <pre><code>{ :foo =&gt; 'bar', :baz =&gt; 'qux' }
  </code></pre>
  
  <p>How could I dynamically set the keys and values to become instance variables in an object...</p>
  
  <pre><code>class Example
    def initialize( hash )
      ... magic happens here...
    end
  end
  </code></pre>
  
  <p>... so that I end up with the following inside the model...</p>
  
  <pre><code>@foo = 'bar'
  @baz = 'qux'
  </code></pre>
  
  <p>?</p>