class Pronto::Punchlist::OffenseMatcher
Matches up the given offense with potentially matching lines
Public Class Methods
new(offense, message_creator: ::Pronto::Punchlist::MessageCreator.new)
click to toggle source
# File lib/pronto/punchlist/offense_matcher.rb, line 10 def initialize(offense, message_creator: ::Pronto::Punchlist::MessageCreator.new) @offense = offense @message_creator = message_creator end
Public Instance Methods
inspect_line(line)
click to toggle source
# 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)
click to toggle source
# File lib/pronto/punchlist/offense_matcher.rb, line 16 def inspect_patch(patch) patch.added_lines.each do |line| message = inspect_line(line) return message unless message.nil? end nil end