class Crowbar::Client::Formatter::Array

Formatter to properly print out arrays in different formats

Public Instance Methods

empty?() click to toggle source
# File lib/crowbar/client/formatter/array.rb, line 27
def empty?
  options[:values].empty?
end

Protected Instance Methods

process_json() click to toggle source
# File lib/crowbar/client/formatter/array.rb, line 44
def process_json
  JSON.pretty_generate(
    options[:values]
  )
end
process_plain() click to toggle source
# File lib/crowbar/client/formatter/array.rb, line 40
def process_plain
  options[:values].join("\n")
end
process_table() click to toggle source
# File lib/crowbar/client/formatter/array.rb, line 33
def process_table
  Terminal::Table.new(
    headings: options[:headings],
    rows: options[:values].zip
  )
end