Module: Ec2spec::PlainTextFormatter
- Defined in:
- lib/ec2spec/plain_text_formatter.rb
Instance Method Summary collapse
Instance Method Details
#output(results, hosts) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/ec2spec/plain_text_formatter.rb', line 3 def output(results, hosts) table = Terminal::Table.new table.headings = table_header(results) table.rows = table_rows(results) column_count = hosts.size + 1 column_count.times { |i| table.align_column(i, :right) } table end |
#table_header(results) ⇒ Object
12 13 14 |
# File 'lib/ec2spec/plain_text_formatter.rb', line 12 def table_header(results) [''].concat(results.map(&:host)) end |
#table_rows(results) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/ec2spec/plain_text_formatter.rb', line 16 def table_rows(results) Ec2spec::HostResult::LABEL_WITH_METHODS .each_with_object([]) do |(k, v), row| row << [k].concat(results.map(&v)) end end |