Class: Circle::CLI::Step

Inherits:
Model
  • Object
show all
Defined in:
lib/circle/cli/step.rb

Constant Summary

Constants inherited from Model

Model::STATUS_COLORS, Model::TIME_FORMAT

Instance Attribute Summary

Attributes inherited from Model

#attributes

Instance Method Summary collapse

Methods inherited from Model

#[], #initialize

Constructor Details

This class inherits a constructor from Circle::CLI::Model

Instance Method Details

#colorObject



6
7
8
# File 'lib/circle/cli/step.rb', line 6

def color
  color_for self[:actions].first['status']
end

#durationObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/circle/cli/step.rb', line 10

def duration
  return unless ms = self[:run_time_millis]

  hours = (ms / (1000 * 60 * 60)) % 24
  minutes = (ms / (1000 * 60)) % 60
  seconds = (ms / 1000) % 60

  message = []
  message << "#{hours}h" unless hours.zero?
  message << "#{minutes}m" unless minutes.zero?
  message << "#{seconds}s" unless seconds.zero?
  message << "#{ms}ms" if message.empty?
  message.join(' ')
end