Class: Circler::StepPrinter
- Inherits:
-
Object
- Object
- Circler::StepPrinter
- Defined in:
- lib/circler/printer/step_printer.rb
Instance Method Summary collapse
-
#initialize(steps, compact: false) ⇒ StepPrinter
constructor
A new instance of StepPrinter.
- #to_s ⇒ Object
Constructor Details
#initialize(steps, compact: false) ⇒ StepPrinter
Returns a new instance of StepPrinter.
3 4 5 6 |
# File 'lib/circler/printer/step_printer.rb', line 3 def initialize(steps, compact: false) @steps = steps @compact = compact end |
Instance Method Details
#to_s ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/circler/printer/step_printer.rb', line 8 def to_s table = Terminal::Table.new do |t| @steps .group_by {|s| s.type } .each do |key, steps| t << :separator t << [{ value: key.green, alignment: :center, :colspan => 2 }] steps.each do |s| t << :separator s.actions.each do |a| t << [ colorize_by_status(a.name.slice(0..120), a.status), format_time(a.run_time_millis) ] if a.failed? && a.log t << [{ value: a.log, alignment: :left, colspan: 2}] end end end end end table.to_s end |