Module: FunCi::Tui::DurationFormatter

Defined in:
lib/fun_ci/tui/duration_formatter.rb

Class Method Summary collapse

Class Method Details

.format(seconds) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fun_ci/tui/duration_formatter.rb', line 6

def self.format(seconds)
  if seconds >= 60
    mins = (seconds / 60).to_i
    secs = (seconds % 60).to_i
    "#{mins}m#{secs.to_s.rjust(2, "0")}"
  elsif seconds == seconds.to_i
    "#{seconds.to_i}s"
  else
    "#{format_decimal(seconds)}s"
  end
end