Class: EagerEye::FixerRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/eager_eye/fixer_registry.rb

Constant Summary collapse

FIXERS =
{
  pluck_to_array: Fixers::PluckToSelect
}.freeze

Class Method Summary collapse

Class Method Details

.fixable?(issue, source_code) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/eager_eye/fixer_registry.rb', line 16

def self.fixable?(issue, source_code)
  fixer = fixer_for(issue, source_code)
  fixer&.fixable? || false
end

.fixer_for(issue, source_code) ⇒ Object



9
10
11
12
13
14
# File 'lib/eager_eye/fixer_registry.rb', line 9

def self.fixer_for(issue, source_code)
  fixer_class = FIXERS[issue.detector]
  return nil unless fixer_class

  fixer_class.new(issue, source_code)
end