lib/cli_format/presenter.rb in cli-format-0.2.2 vs lib/cli_format/presenter.rb in cli-format-0.3.0

- old
+ new

@@ -4,13 +4,15 @@ def initialize(options) @options = options @rows = [] end - def show + delegate :text, :show, to: :presenter + + def presenter + return @presenter if @presenter presenter_class = "CliFormat::Presenter::#{format.camelize}".constantize - presenter = presenter_class.new(@options, @header, @rows) - presenter.show + @presenter = presenter_class.new(@options, @header, @rows) end # Formats: tabs, markdown, json, csv, table, etc def format @options[:format] || ENV['CLI_FORMAT'] || CliFormat.default_format # table