title: Converting hash values to integers
body: <p>I have a small program that creates a hash and stores the current datetime, where the year, month, and day are stored as separate values. This requires me to convert the <code>Time</code> object into a <code>String</code> object, but I would like to store the values as <code>Integer</code> objects for later comparison.</p>
  
  <pre><code>current = {}
  
  current[:year], current[:month], current[:day] = Time.now.to_s[0..10].split('-')
  </code></pre>
  
  <p>I achieved this by writing the following code:</p>
  
  <pre><code>current.map { |key, value| current[key] = value.to_i }
  </code></pre>
  
  <p>However, I noticed that <code>Ruby 2.4.0</code> comes with a neat method for destructively transforming hash values, allowing me to pass a proc as an argument:</p>
  
  <pre><code>current.transform_values!(&amp;:to_i)
  </code></pre>
  
  <p>My question is: <em>how would you go about writing the equivalent of the previous line of code in earlier versions of Ruby?</em> I ask because I think the map method becomes unnecessarily long.</p>