Sha256: d8a443932d2259cff639fe3f86cf752d5a483acd501774b68f78414be4f0000e

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

module Ec2spec
  module PlainTextFormatter
    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

    def table_header(results)
      [''].concat(results.map(&:host))
    end

    def table_rows(results)
      Ec2spec::HostResult::LABEL_WITH_METHODS
        .each_with_object([]) do |(k, v), row|
        row << [k].concat(results.map(&v))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ec2spec-0.1.2 lib/ec2spec/plain_text_formatter.rb