Class: Scripted::Formatters::Table
- Includes:
- HumanStatus
- Defined in:
- lib/scripted/formatters/table.rb
Defined Under Namespace
Classes: Column
Instance Attribute Summary
Attributes inherited from Blank
Instance Method Summary collapse
Methods included from HumanStatus
Methods inherited from Blank
#close, #done, #each_char, #exception, #execute, #halted, #initialize, #start
Constructor Details
This class inherits a constructor from Scripted::Formatters::Blank
Instance Method Details
#stop(commands, runner) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/scripted/formatters/table.rb', line 11 def stop(commands, runner) report_lines << [ Column["Command"], Column["Runtime"], Column["Status"] ] commands.each do |command| report_lines << [ Column[command.name], Column[command.runtime, "s"], Column[human_status(command)] ] end widths = report_lines.transpose.map { |line| line.max_by(&:size).size } header = report_lines.shift puts "" puts "" puts separator(widths, "┌", "┬", "┐") puts report_line(header, widths) puts separator(widths, "├", "┼", "┤") report_lines.each do |line| puts report_line(line, widths) end puts separator(widths, "└", "┴", "┘") puts " Total runtime: #{Column[runner.runtime, "s"]}" end |