Class: LintTrappings::LinterLoader

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

Overview

Loads linters so they can be run.

Instance Method Summary collapse

Constructor Details

#initialize(application, config) ⇒ LinterLoader

Returns a new instance of LinterLoader.


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

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

Instance Method Details

#load(options) ⇒ Object

Load linters into memory so they can be instantiated.

Parameters:

  • options (Hash)

Raises:


14
15
16
17
18
19
20
21
# File 'lib/lint_trappings/linter_loader.rb', line 14

def load(options)
  load_directory(@application.linters_directory)

  directories = Array(@config['linter_directories']) + Array(options[:linter_directories])
  directories.each do |directory|
    load_directory(directory)
  end
end