title: Ruby: Mapping a Hash
body: <p>In Python, I can create a test hash with list comprehension that I check against a suite of test(s). How can I achieve the same thing in ruby? (I'm running on ruby 1.9.3)</p>
  
  <p><strong>Python:</strong></p>
  
  <pre><code>test = {x: self.investor.annual_return(x) for x in xrange(1, 6)}
  </code></pre>
  
  <p><strong>Ruby (attempt):</strong></p>
  
  <pre><code>test = Hash[(1..5).map { |x| [x, @investor.annual_return(x)] }]
  </code></pre>