Module: CukeLinter::LinterRegistration

Included in:
CukeLinter
Defined in:
lib/cuke_linter/linter_registration.rb

Overview

Mix-in module containing methods related to registering linters

Instance Method Summary collapse

Instance Method Details

#clear_registered_lintersObject

Unregisters all currently registered linting objects



27
28
29
# File 'lib/cuke_linter/linter_registration.rb', line 27

def clear_registered_linters
  registered_linters.clear
end

#register_linter(linter:, name:) ⇒ Object

Registers for linting use the given linter object, tracked by the given name



12
13
14
# File 'lib/cuke_linter/linter_registration.rb', line 12

def register_linter(linter:, name:)
  registered_linters[name] = linter
end

#registered_lintersObject

Lists the names of the currently registered linting objects



22
23
24
# File 'lib/cuke_linter/linter_registration.rb', line 22

def registered_linters
  @registered_linters ||= Marshal.load(Marshal.dump(@original_linters))
end

#reset_lintersObject

Returns the registered linters to their default state



7
8
9
# File 'lib/cuke_linter/linter_registration.rb', line 7

def reset_linters
  @registered_linters = nil
end

#unregister_linter(name) ⇒ Object

Unregisters the linter object tracked by the given name so that it is not used for linting



17
18
19
# File 'lib/cuke_linter/linter_registration.rb', line 17

def unregister_linter(name)
  registered_linters.delete(name)
end