module Tumugi::Mixin::HumanReadable
Public Instance Methods
human_readable_time(seconds)
click to toggle source
# File lib/tumugi/mixin/human_readable.rb, line 4 def human_readable_time(seconds) [[60, :s], [60, :m], [10000, :h]].map{|count, name| if seconds > 0 seconds, n = seconds.divmod(count) "#{sprintf('%02d', n)}" else '00' end }.compact.reverse.join(':') end