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

jira_issue_key_extractor.rb « atlassian « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 881ba4544b24a80ae60ab35529e6de40477db564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Atlassian
  class JiraIssueKeyExtractor
    def self.has_keys?(...)
      new(...).issue_keys.any?
    end

    def initialize(*text, custom_regex: nil)
      @text = text.join(' ')
      @match_regex = custom_regex || Gitlab::Regex.jira_issue_key_regex
    end

    def issue_keys
      @text.scan(@match_regex).flatten.uniq
    end
  end
end