Class: EagerEye::FixerRegistry
- Inherits:
-
Object
- Object
- EagerEye::FixerRegistry
- Defined in:
- lib/eager_eye/fixer_registry.rb
Constant Summary collapse
- FIXERS =
{ pluck_to_array: Fixers::PluckToSelect, count_in_iteration: Fixers::CountToSize, loop_association: Fixers::AddIncludes }.freeze
Class Method Summary collapse
Class Method Details
.fixable?(issue, source_code) ⇒ Boolean
18 19 20 21 |
# File 'lib/eager_eye/fixer_registry.rb', line 18 def self.fixable?(issue, source_code) fixer = fixer_for(issue, source_code) fixer&.fixable? || false end |
.fixer_for(issue, source_code) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/eager_eye/fixer_registry.rb', line 11 def self.fixer_for(issue, source_code) fixer_class = FIXERS[issue.detector] return nil unless fixer_class fixer_class.new(issue, source_code) end |