class CliFormat::Presenter

Attributes

header[RW]
rows[RW]

Public Class Methods

new(options) click to toggle source
# File lib/cli_format/presenter.rb, line 4
def initialize(options)
  @options = options
  @rows = []
end

Public Instance Methods

format() click to toggle source

Formats: tabs, markdown, json, csv, table, etc

# File lib/cli_format/presenter.rb, line 16
def format
  @options[:format] || ENV['CLI_FORMAT'] || "table"
end
show() click to toggle source
# File lib/cli_format/presenter.rb, line 9
def show
  presenter_class = "CliFormat::Presenter::#{format.classify}".constantize
  presenter = presenter_class.new(@options, @header, @rows)
  presenter.show
end