title: how can I convert milliseconds in String format to HH:MM:SS format in Ruby in under 3 lines of code?
body: <pre><code>@scores_raw.each do |score_raw|
    # below is code if time was being sent in milliseconds
    hh = ((score_raw.score.to_i)/100)/3600
    mm = (hh-hh.to_i)*60
    ss = (mm-mm.to_i)*60
    crumbs = [hh,mm,ss]
    sum = crumbs.first.to_i*3600+crumbs[1].to_i*60+crumbs.last.to_i
    @scores &lt;&lt; {:secs =&gt; sum, :hms =&gt; hh.round.to_s+":"+mm.round.to_s+":"+ss.round.to_s}
    @scores_hash &lt;&lt; {:secs =&gt; sum, :hms =&gt; hh.round.to_s+":"+mm.round.to_s+":"+ss.round.to_s}
    # milliseconds case end
  end
  </code></pre>
  
  <p>That's my current code but I hate it. It's looks messy. It doesn't just look great at all. Maybe someone whose an expert in ruby could tell how to do this by chaining collects, reduces etc and making it look good?</p>