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



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

def formatter
  formatter_class.new(item_hash)
end

#formatter_classClass

Returns:

  • (Class)


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

def formatter_class
  FORMATS.fetch(parsed.format)
end

#output_contentString

Returns:

  • (String)


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

def output_content
  formatter.to_output
end