Module: SlimLint::LinterRegistry

Overview

Stores all defined linters.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.lintersObject (readonly)

List of all registered linters.



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

def linters
  @linters
end

Class Method Details

.extract_linters_from(linter_names) ⇒ Array<Class>

Return a list of SlimLint::Linter Classes corresponding to the specified list of names.

Parameters:

  • linter_names (Array<String>)

Returns:

  • (Array<Class>)


28
29
30
31
32
33
34
# File 'lib/slim_lint/linter_registry.rb', line 28

def extract_linters_from(linter_names)
  linter_names.map do |linter_name|
    SlimLint::Linter.const_get(linter_name)
  rescue NameError
    raise NoSuchLinter, "Linter #{linter_name} does not exist"
  end
end

.included(subclass) ⇒ Object

Executed when a linter includes the SlimLint::LinterRegistry module.

This results in the linter being registered with the registry.

Parameters:

  • subclass (Class)


19
20
21
# File 'lib/slim_lint/linter_registry.rb', line 19

def included(subclass)
  @linters << subclass
end