Module: Debci::Test::Duration

Included in:
Job
Defined in:
lib/debci/test/duration.rb

Instance Method Summary collapse

Instance Method Details

#duration_humanObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/debci/test/duration.rb', line 4

def duration_human
  return '(n/a)' if duration_seconds.nil?
  return '0s' if duration_seconds == 0
  s = duration_seconds.to_i
  {
    h: s / 3600,
    m: (s % 3600) / 60,
    s: s % 60,
  }.select { |_, v| v > 0 }.map { |k, v| v.to_s + k.to_s }.join(' ')
end