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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/atlassian/jira_issue_key_extractor.rb')
-rw-r--r--lib/atlassian/jira_issue_key_extractor.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/atlassian/jira_issue_key_extractor.rb b/lib/atlassian/jira_issue_key_extractor.rb
new file mode 100644
index 00000000000..f1b432787ac
--- /dev/null
+++ b/lib/atlassian/jira_issue_key_extractor.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Atlassian
+ class JiraIssueKeyExtractor
+ def self.has_keys?(*text)
+ new(*text).issue_keys.any?
+ end
+
+ def initialize(*text)
+ @text = text.join(' ')
+ end
+
+ def issue_keys
+ @text.scan(Gitlab::Regex.jira_issue_key_regex).uniq
+ end
+ end
+end