class SecondsToHhmmss

Public Class Methods

format(seconds) click to toggle source
# File lib/seconds_to_hhmmss.rb, line 2
def self.format(seconds)
  hours = seconds / 3600
  minutes = (seconds / 60) % 60
  seconds = seconds % 60
  [hours, minutes, seconds].map do |item| 
    item.to_s.rjust(2,'0')
  end.join(':')
end