Class: Gitlab::StringRegexMarker
- Inherits:
-
StringRangeMarker
- Object
- StringRangeMarker
- Gitlab::StringRegexMarker
- Defined in:
- lib/gitlab/string_regex_marker.rb
Instance Attribute Summary
Attributes inherited from StringRangeMarker
#html_escaped, #raw_line, #rich_line
Instance Method Summary collapse
Methods inherited from StringRangeMarker
Constructor Details
This class inherits a constructor from Gitlab::StringRangeMarker
Instance Method Details
#mark(regex, group: 0, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gitlab/string_regex_marker.rb', line 5 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 |