debian-mirror-gitlab/lib/gitlab/email/handler.rb

28 lines
536 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2016-09-13 17:45:13 +05:30
module Gitlab
module Email
module Handler
2018-11-20 20:47:30 +05:30
def self.handlers
@handlers ||= load_handlers
end
def self.load_handlers
[
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
]
end
2016-09-13 17:45:13 +05:30
def self.for(mail, mail_key)
2018-11-20 20:47:30 +05:30
handlers.find do |klass|
2016-09-13 17:45:13 +05:30
handler = klass.new(mail, mail_key)
break handler if handler.can_handle?
end
end
end
end
end