Class: EagerEye::FixerRegistry

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

Constant Summary collapse

FIXERS =
{
  count_in_iteration: Fixers::CountToSize,
  pluck_to_array: Fixers::PluckToSelect
}.freeze

Class Method Summary collapse

Class Method Details

.fixable?(issue, source_code) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.fixer_for(issue, source_code) ⇒ Object



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

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

  fixer_class.new(issue, source_code)
end