Class: Circler::StepPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/circler/printer/step_printer.rb

Instance Method Summary collapse

Constructor Details

#initialize(steps, pretty: true) ⇒ StepPrinter

Returns a new instance of StepPrinter.



5
6
7
8
# File 'lib/circler/printer/step_printer.rb', line 5

def initialize(steps, pretty: true)
  @steps = steps
  @pretty = pretty
end

Instance Method Details

#to_sObject



10
11
12
13
14
15
16
17
18
19
20
# 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