debian-mirror-gitlab/lib/gitlab/email/handler.rb
2018-11-20 20:47:30 +05:30

27 lines
536 B
Ruby

# frozen_string_literal: true
module Gitlab
module Email
module Handler
def self.handlers
@handlers ||= load_handlers
end
def self.load_handlers
[
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
]
end
def self.for(mail, mail_key)
handlers.find do |klass|
handler = klass.new(mail, mail_key)
break handler if handler.can_handle?
end
end
end
end
end