BigW Consortium Gitlab

closing_issue_extractor.rb 520 Bytes
Newer Older
1
module Gitlab
2
  class ClosingIssueExtractor
3 4
    ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)

5 6 7
    def initialize(project, current_user = nil)
      @extractor = Gitlab::ReferenceExtractor.new(project, current_user)
    end
8

9 10 11 12 13
    def closed_by_message(message)
      return [] if message.nil?
      
      closing_statements = message.scan(ISSUE_CLOSING_REGEX).
        map { |ref| ref[0] }.join(" ")
14

15
      @extractor.analyze(closing_statements)
16

17
      @extractor.issues
18 19 20
    end
  end
end