gitlab-org--gitlab-foss/lib/gitlab/closing_issue_extractor.rb

21 lines
514 B
Ruby
Raw Normal View History

module Gitlab
2015-04-03 16:03:26 +00:00
class ClosingIssueExtractor
ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)
2015-04-03 16:03:26 +00:00
def initialize(project, current_user = nil)
@extractor = Gitlab::ReferenceExtractor.new(project, current_user)
end
2015-04-03 16:03:26 +00:00
def closed_by_message(message)
return [] if message.nil?
2015-05-21 20:35:15 +00:00
2015-04-03 16:03:26 +00:00
closing_statements = message.scan(ISSUE_CLOSING_REGEX).
map { |ref| ref[0] }.join(" ")
2015-04-03 16:03:26 +00:00
@extractor.analyze(closing_statements)
2015-04-03 16:03:26 +00:00
@extractor.issues
end
end
end