title: Ruby: Transform two-dimensional array into sorted hash with keys based on the first letter of the first element
body: <p>Say I have the following two-dimensional array (unsorted)</p>
  
  <pre><code>[["Abigail", 1047], ["Betty", 1049], ["Alfred", 1048], ["Bernadette", 1050]]
  </code></pre>
  
  <p>How can I transform this into a hash with alphabetical keys based on the first letter of the first element? The key would need to be sorted as well as the array elements, based on their first element (i.e. the person's name in this case):</p>
  
  <pre><code>{
  'A' =&gt; [['Abigail','1047'], ['Alfred','1048']],
  'B' =&gt; [['Bernadette','1050'], ['Betty','1049']]
  }
  </code></pre>