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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-10 23:17:20 +0300
committerDouwe Maan <douwe@selenight.nl>2017-05-10 16:26:21 +0300
commit3f6d91c53c1bf99ce2e7dfeb9c25ef5f8149b72e (patch)
tree6aa3c7cc777857ed6a35a50612cf9fec83c94493 /lib
parente179707844b043fac6f81a30f82e5f4ba446abde (diff)
Add Gitlab::StringRegexMarker
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/string_regex_marker.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab/string_regex_marker.rb b/lib/gitlab/string_regex_marker.rb
new file mode 100644
index 00000000000..7ebf1c0428c
--- /dev/null
+++ b/lib/gitlab/string_regex_marker.rb
@@ -0,0 +1,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