Class: Exa::CLI::Formatters::TableFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/exa/cli/formatters.rb

Instance Method Summary collapse

Instance Method Details

#render(cli:, payload:, collection:) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/exa/cli/formatters.rb', line 77

def render(cli:, payload:, collection:)
  if collection && !collection.empty?
    collection.each_with_index do |item, index|
      cli.say cli.send(:format_collection_entry, item, index)
    end
  elsif collection
    cli.say "No results."
  else
    cli.say cli.send(:format_single_entry, payload)
  end
end