class Danger::MatchesInDiff::Patch
Parsed patch
Constants
- MODIFIED_LINE
- NOT_REMOVED_LINE
- RANGE_INFORMATION_LINE
- REMOVED_LINE
Public Class Methods
new(body)
click to toggle source
# File lib/todoist/diff_todo_finder.rb, line 85 def initialize(body) @body = body end
Public Instance Methods
changed_lines()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/todoist/diff_todo_finder.rb, line 90 def changed_lines line_number = 0 lines_with_index .each_with_object([]) do |(content, patch_position), lines| case content when RANGE_INFORMATION_LINE line_number = Regexp.last_match[:line_number].to_i when MODIFIED_LINE lines << Line.new(content, line_number, patch_position) line_number += 1 when NOT_REMOVED_LINE line_number += 1 end end end
lines()
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/todoist/diff_todo_finder.rb, line 108 def lines @body.lines end
lines_with_index()
click to toggle source
# File lib/todoist/diff_todo_finder.rb, line 112 def lines_with_index lines.each_with_index end