title: Array into ranges of consecutive numbers
body: <p>I am trying to make a Ruby function that converts an array of unique numbers into ranges of consecutive numbers.</p>
  
  <pre><code>[1, 2, 3, 5, 6, 8, 9] =&gt; [(1..3), (5..6), (8..9)]
  </code></pre>
  
  <p>It doesn't seem too hard, but I want to know if there's better way.</p>