class Circler::StepPrinter

Public Class Methods

new(steps, pretty: true) click to toggle source
# File lib/circler/printer/step_printer.rb, line 5
def initialize(steps, pretty: true)
  @steps = steps
  @pretty = pretty
end

Public Instance Methods

to_s() click to toggle source
# File lib/circler/printer/step_printer.rb, line 10
def to_s
  Terminal::Table.new do |t|
    @steps
      .group_by(&:type)
      .each do |key, steps|
        t << :separator
        t << [{ value: key.green, alignment: :center, colspan: 2 }]
        steps.each { |s| print_actions(t, s) }
      end
  end.to_s
end

Private Instance Methods

colorize_by_status(string, status) click to toggle source
# File lib/circler/printer/step_printer.rb, line 24
def colorize_by_status(string, status)
  case status
  when 'success', 'fixed' then string.green
  when 'canceled' then string.yellow
  when 'failed', 'timedout' then string.red
  when 'no_tests', 'not_run' then string.light_black
  else string
  end
end
format_time(time) click to toggle source
# File lib/circler/printer/step_printer.rb, line 34
def format_time(time)
  return '' unless time

  minute = format('%02d', time / 1000 / 60)
  second = format('%02d', (time / 1000) % 60)
  "#{minute}:#{second}"
end
print_actions(table, step) click to toggle source