Class: FormatterFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/chelsea/formatters/factory.rb

Overview

Factory for formatting dependencies

Instance Method Summary collapse

Instance Method Details

#get_formatter(verbose:, format: 'text') ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/chelsea/formatters/factory.rb', line 25

def get_formatter(verbose:, format: 'text')
  case format
  when 'text'
    Chelsea::TextFormatter.new verbose: verbose
  when 'json'
    Chelsea::JsonFormatter.new verbose: verbose
  when 'xml'
    Chelsea::XMLFormatter.new verbose: verbose
  else # rubocop:disable Lint/DuplicateBranch
    Chelsea::TextFormatter.new verbose: verbose
  end
end