Class: LintTrappings::FormatterLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/lint_trappings/formatter_loader.rb

Overview

Loads the configured formatters.

Instance Method Summary collapse

Constructor Details

#initialize(application, config, output) ⇒ FormatterLoader

Returns a new instance of FormatterLoader.



4
5
6
7
8
# File 'lib/lint_trappings/formatter_loader.rb', line 4

def initialize(application, config, output)
  @application = application
  @config = config
  @output = output
end

Instance Method Details

#load(options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/lint_trappings/formatter_loader.rb', line 10

def load(options)
  outputs = options.fetch(:formatters, [{ 'Default' => :stdout }])

  outputs.map do |output_specification|
    output_specification.map do |formatter_name, output_path|
      load_formatter(formatter_name)
      create_formatter(formatter_name, output_path, options)
    end
  end.flatten
end