debian-mirror-gitlab/lib/gitlab/closing_issue_extractor.rb

21 lines
514 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module Gitlab
2015-04-26 12:48:37 +05:30
class ClosingIssueExtractor
2014-09-02 18:07:02 +05:30
ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)
2015-04-26 12:48:37 +05:30
def initialize(project, current_user = nil)
@extractor = Gitlab::ReferenceExtractor.new(project, current_user)
end
def closed_by_message(message)
return [] if message.nil?
2015-09-11 14:41:01 +05:30
2015-04-26 12:48:37 +05:30
closing_statements = message.scan(ISSUE_CLOSING_REGEX).
map { |ref| ref[0] }.join(" ")
@extractor.analyze(closing_statements)
@extractor.issues
2014-09-02 18:07:02 +05:30
end
end
end