title: Converting an array of keys and an array of values into a hash in Ruby
body: <p>I have two arrays like this:</p>
  
  <pre><code>keys = ['a', 'b', 'c']
  values = [1, 2, 3]
  </code></pre>
  
  <p>Is there a simple way in Ruby to convert those arrays into the following hash?</p>
  
  <pre><code>{ 'a' =&gt; 1, 'b' =&gt; 2, 'c' =&gt; 3 }
  </code></pre>
  
  <p>Here is my way of doing it, but I feel like there should be a built-in method to easily do this.</p>
  
  <pre><code>def arrays2hash(keys, values)
    hash = {}
    0.upto(keys.length - 1) do |i|
        hash[keys[i]] = values[i]
    end
    hash
  end
  </code></pre>