title: How to sort an an array having mulitple time slots
body: <p>I have an array <code>collected_slots = [&quot;09:30&quot;, &quot;09:45&quot;, &quot;09:40&quot;, &quot;09:55&quot;, &quot;09:35&quot;, &quot;09:50&quot;]</code></p>
  <p>I have to sort it on the bases of the time, I have tried</p>
  <pre><code>sorted_slots = collected_slots.sort_by do |slot|
  parsed = collected_slots[:time].split('-').first
  [parsed&amp;.to_i, parsed.split(':').second&amp;.to_i]
  </code></pre>
  <p>but it doesn't work</p>
  <p>What I want is <code>collected_slots = [&quot;09:30-09:35&quot;, &quot;09:35-09:40&quot;, &quot;09:40-09:45&quot;, &quot;09:45-09:50&quot;, &quot;09:50-09:55&quot;]</code></p>
  <p>I have tried but it doesn't works. Please help me with this.</p>