Sha256: b1eec5bd8cef77b23eb01db1a92b04be83cc5b2067cafbb6a5b4fbc7b8021e1d

Contents?: true

Size: 475 Bytes

Versions: 3

Compression:

Stored size: 475 Bytes

Contents

module CliFormat
  class Presenter
    attr_accessor :header, :rows
    def initialize(options)
      @options = options
      @rows = []
    end

    def show
      presenter_class = "CliFormat::Presenter::#{format.classify}".constantize
      presenter = presenter_class.new(@options, @header, @rows)
      presenter.show
    end

    # Formats: tabs, markdown, json, csv, table, etc
    def format
      @options[:format] || ENV['CLI_FORMAT'] || "table"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cli-format-0.2.1 lib/cli_format/presenter.rb
cli-format-0.2.0 lib/cli_format/presenter.rb
cli-format-0.1.0 lib/cli_format/presenter.rb