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: b19aa6dea358c72ec08bcf29ac97cafd72379293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Gitlab
  class StringRegexMarker < StringRangeMarker
    def mark(regex, group: 0, &block)
      ranges = []

      raw_line.scan(regex) do
        begin_index, end_index = Regexp.last_match.offset(group)

        ranges << (begin_index..(end_index - 1))
      end

      super(ranges, &block)
    end
  end
end