gitlab-org--gitlab-foss/lib/gitlab/closing_issue_extractor.rb
2015-05-26 15:49:22 -04:00

20 lines
514 B
Ruby

module Gitlab
class ClosingIssueExtractor
ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)
def initialize(project, current_user = nil)
@extractor = Gitlab::ReferenceExtractor.new(project, current_user)
end
def closed_by_message(message)
return [] if message.nil?
closing_statements = message.scan(ISSUE_CLOSING_REGEX).
map { |ref| ref[0] }.join(" ")
@extractor.analyze(closing_statements)
@extractor.issues
end
end
end