Class: Pronto::Punchlist::OffenseMatcher
- Inherits:
-
Object
- Object
- Pronto::Punchlist::OffenseMatcher
- Defined in:
- lib/pronto/punchlist/offense_matcher.rb
Overview
Matches up the given offense with potentially matching lines
Instance Method Summary collapse
-
#initialize(offense, message_creator: ::Pronto::Punchlist::MessageCreator.new) ⇒ OffenseMatcher
constructor
A new instance of OffenseMatcher.
- #inspect_line(line) ⇒ Object
- #inspect_patch(patch) ⇒ Object
Constructor Details
#initialize(offense, message_creator: ::Pronto::Punchlist::MessageCreator.new) ⇒ OffenseMatcher
Returns a new instance of OffenseMatcher.
10 11 12 13 14 |
# File 'lib/pronto/punchlist/offense_matcher.rb', line 10 def initialize(offense, message_creator: ::Pronto::Punchlist::MessageCreator.new) @offense = offense @message_creator = end |
Instance Method Details
#inspect_line(line) ⇒ Object
24 25 26 27 28 |
# File 'lib/pronto/punchlist/offense_matcher.rb', line 24 def inspect_line(line) return nil unless line.new_lineno == @offense.line_num @message_creator.create(line.patch.delta.new_file[:path], line) end |
#inspect_patch(patch) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/pronto/punchlist/offense_matcher.rb', line 16 def inspect_patch(patch) patch.added_lines.each do |line| = inspect_line(line) return unless .nil? end nil end |