blob: 8e0167a433e8391955efd77304c6e94f9731cefc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# frozen_string_literal: true
module Gitlab
class StringRegexMarker < StringRangeMarker
def mark(regex, group: 0, &block)
ranges = []
offset = 0
while match = regex.match(raw_line[offset..])
begin_index = match.begin(group) + offset
end_index = match.end(group) + offset
ranges << (begin_index..(end_index - 1))
offset = end_index
end
super(ranges, &block)
end
end
end
|