Module: Console::Utils
- Defined in:
- lib/jarl/console.rb
Overview
module Shell
Instance Method Summary collapse
Instance Method Details
#seconds_to_human(s) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jarl/console.rb', line 10 def seconds_to_human(s) s = s.round m = (s / 60).floor s = s % 60 h = (m / 60).floor m = m % 60 d = (h / 24).floor h = h % 24 output = "#{s}s" output = "#{m}m " + output if m > 0 || h > 0 || d > 0 output = "#{h}h " + output if h > 0 || d > 0 output = "#{d}d " + output if d > 0 output end |