Commit 489e1937 authored by Douwe Maan's avatar Douwe Maan

Rename constant to be more descriptive

parent e981d6cd
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module Diff module Diff
class InlineDiff class InlineDiff
# Regex to find a run of deleted lines followed by the same number of added lines # Regex to find a run of deleted lines followed by the same number of added lines
REGEX = %r{ LINE_PAIRS_PATTERN = %r{
# Runs start at the beginning of the string (the first line) or after a space (for an unchanged line) # Runs start at the beginning of the string (the first line) or after a space (for an unchanged line)
(?:\A|\s) (?:\A|\s)
...@@ -72,7 +72,7 @@ module Gitlab ...@@ -72,7 +72,7 @@ module Gitlab
line_prefixes = lines.each_with_object("") { |line, s| s << line[0] }.gsub(/[^ +-]/, ' ') line_prefixes = lines.each_with_object("") { |line, s| s << line[0] }.gsub(/[^ +-]/, ' ')
changed_line_pairs = [] changed_line_pairs = []
line_prefixes.scan(REGEX) do line_prefixes.scan(LINE_PAIRS_PATTERN) do
# For `"---+++"`, `begin_index == 0`, `end_index == 6` # For `"---+++"`, `begin_index == 0`, `end_index == 6`
begin_index, end_index = Regexp.last_match.offset(:del_ins) begin_index, end_index = Regexp.last_match.offset(:del_ins)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment