title: What is the best way to convert an array to a hash in Ruby
body: <p>In Ruby, given an array in one of the following forms...</p>
  
  <pre><code>[apple, 1, banana, 2]
  [[apple, 1], [banana, 2]]
  </code></pre>
  
  <p>...what is the best way to convert this into a hash in the form of...</p>
  
  <pre><code>{apple =&gt; 1, banana =&gt; 2}
  </code></pre>