Welcome to mirror list, hosted at ThFree Co, Russian Federation.

string_regex_marker.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ebf1c0428ca2786435c73e98b0489a56b7f71e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module Gitlab
  class StringRegexMarker < StringRangeMarker
    def mark(regex, group: 0, &block)
      regex_match = raw_line.match(regex)
      return rich_line unless regex_match

      begin_index, end_index = regex_match.offset(group)
      name_range = begin_index..(end_index - 1)

      super([name_range], &block)
    end
  end
end