Module: ERBLint::LinterRegistry

Overview

Stores all linters available to the application.

Constant Summary collapse

CUSTOM_LINTERS_DIR =
'.erb-linters'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.lintersObject (readonly)

Returns the value of attribute linters.



10
11
12
# File 'lib/erb_lint/linter_registry.rb', line 10

def linters
  @linters
end

Class Method Details

.find_by_name(name) ⇒ Object



16
17
18
# File 'lib/erb_lint/linter_registry.rb', line 16

def find_by_name(name)
  linters.detect { |linter| linter.simple_name == name }
end

.included(linter_class) ⇒ Object



12
13
14
# File 'lib/erb_lint/linter_registry.rb', line 12

def included(linter_class)
  @linters << linter_class
end

.load_custom_linters(directory = CUSTOM_LINTERS_DIR) ⇒ Object



20
21
22
23
# File 'lib/erb_lint/linter_registry.rb', line 20

def load_custom_linters(directory = CUSTOM_LINTERS_DIR)
  ruby_files = Dir.glob(File.expand_path(File.join(directory, '**', '*.rb')))
  ruby_files.each { |file| require file }
end