module Ec2spec::Formatter::PlainTextFormatter
Public Instance Methods
output(results, hosts)
click to toggle source
# File lib/ec2spec/formatter/plain_text_formatter.rb, line 4 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)
click to toggle source
# File lib/ec2spec/formatter/plain_text_formatter.rb, line 13 def table_header(results) [''].concat(results.map(&:host)) end
table_rows(results)
click to toggle source
# File lib/ec2spec/formatter/plain_text_formatter.rb, line 17 def table_rows(results) Ec2spec::HostResult.label_with_methods .each_with_object([]) do |(k, v), row| unit = PriceCalculator.instance.currency_unit label = format(k, unit) row << [label].concat(results.map(&v)) end end