Class: Packwerk::ReferenceChecking::ReferenceChecker
- Inherits:
-
Object
- Object
- Packwerk::ReferenceChecking::ReferenceChecker
- Extended by:
- T::Sig
- Defined in:
- lib/packwerk/reference_checking/reference_checker.rb
Instance Method Summary collapse
- #call(reference) ⇒ Object
-
#initialize(checkers) ⇒ ReferenceChecker
constructor
A new instance of ReferenceChecker.
Constructor Details
#initialize(checkers) ⇒ ReferenceChecker
Returns a new instance of ReferenceChecker.
10 11 12 |
# File 'lib/packwerk/reference_checking/reference_checker.rb', line 10 def initialize(checkers) @checkers = checkers end |
Instance Method Details
#call(reference) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/packwerk/reference_checking/reference_checker.rb', line 19 def call(reference) @checkers.each_with_object([]) do |checker, violations| next unless checker.invalid_reference?(reference) offense = Packwerk::ReferenceOffense.new( location: reference.source_location, reference: reference, violation_type: checker.violation_type, message: checker.(reference) ) violations << offense end end |