Module: EacCli::RunnerWith::OutputItem

Defined in:
lib/eac_cli/runner_with/output_item.rb,
lib/eac_cli/runner_with/output_item/csv_formatter.rb,
lib/eac_cli/runner_with/output_item/base_formatter.rb,
lib/eac_cli/runner_with/output_item/yaml_formatter.rb

Defined Under Namespace

Classes: BaseFormatter, CsvFormatter, YamlFormatter

Constant Summary collapse

FORMATS =
{
  'csv' => ::EacCli::RunnerWith::OutputItem::CsvFormatter,
  'yaml' => ::EacCli::RunnerWith::OutputItem::YamlFormatter
}.freeze

Instance Method Summary collapse

Instance Method Details

#formatterEacCli::RunnerWith::OutputList::BaseFormatter



31
32
33
# File 'lib/eac_cli/runner_with/output_item.rb', line 31

def formatter
  formatter_class.new(item_hash)
end

#formatter_classClass

Returns:

  • (Class)


36
37
38
# File 'lib/eac_cli/runner_with/output_item.rb', line 36

def formatter_class
  FORMATS.fetch(parsed.format)
end

#output_contentString

Returns:

  • (String)


26
27
28
# File 'lib/eac_cli/runner_with/output_item.rb', line 26

def output_content
  formatter.to_output
end