lib/rubocop/git/patch.rb in rubocop-git2-0.1.4 vs lib/rubocop/git/patch.rb in rubocop-git2-0.1.5
- old
+ new
@@ -1,11 +1,10 @@
-module RuboCop::Git
# copy from https://github.com/thoughtbot/hound/blob/5269fa5/app/models/patch.rb
-class Patch
- RANGE_INFORMATION_LINE = /^@@ .+\+(?<line_number>\d+),/
- MODIFIED_LINE = /^\+(?!\+|\+)/
- NOT_REMOVED_LINE = /^[^-]/
+class RuboCop::Git::Patch
+ RANGE_INFORMATION_LINE = /^@@ .+\+(?<line_number>\d+),/.freeze
+ MODIFIED_LINE = /^\+(?!\+|\+)/.freeze
+ NOT_REMOVED_LINE = /^[^-]/.freeze
def initialize(body)
@body = body || ''
end
@@ -16,11 +15,11 @@
with_index do |(content, hash), patch_position|
case content
when RANGE_INFORMATION_LINE
line_number = Regexp.last_match[:line_number].to_i
when MODIFIED_LINE
- line = Line.new(content, line_number, patch_position)
+ line = RuboCop::Git::Line.new(content, line_number, patch_position)
hash[line_number] = line
line_number += 1
when NOT_REMOVED_LINE
line_number += 1
end
@@ -30,7 +29,6 @@
private
def lines
@body.each_line
end
-end
end