Class: ImproveYourCode::DetectorRepository
- Inherits:
-
Object
- Object
- ImproveYourCode::DetectorRepository
- Defined in:
- lib/improve_your_code/detector_repository.rb
Class Method Summary collapse
Instance Method Summary collapse
- #examine(context) ⇒ Object
-
#initialize(smell_types: self.class.smell_types) ⇒ DetectorRepository
constructor
A new instance of DetectorRepository.
Constructor Details
#initialize(smell_types: self.class.smell_types) ⇒ DetectorRepository
Returns a new instance of DetectorRepository.
13 14 15 |
# File 'lib/improve_your_code/detector_repository.rb', line 13 def initialize(smell_types: self.class.smell_types) @smell_types = smell_types end |
Class Method Details
.eligible_smell_types ⇒ Object
8 9 10 11 |
# File 'lib/improve_your_code/detector_repository.rb', line 8 def self.eligible_smell_types ImproveYourCode::SmellDetectors::BaseDetector .descendants.sort_by(&:name) end |
Instance Method Details
#examine(context) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/improve_your_code/detector_repository.rb', line 17 def examine(context) smell_detectors_for(context.type).flat_map do |klass| detector = klass.new context: context detector.run end end |