BigW Consortium Gitlab

handler.rb 521 Bytes
Newer Older
1 2
require 'gitlab/email/handler/create_note_handler'
require 'gitlab/email/handler/create_issue_handler'
3
require 'gitlab/email/handler/unsubscribe_handler'
4

5 6
module Gitlab
  module Email
7
    module Handler
8 9 10 11 12
      HANDLERS = [
        UnsubscribeHandler,
        CreateNoteHandler,
        CreateIssueHandler
      ].freeze
13

14
      def self.for(mail, mail_key)
15
        HANDLERS.find do |klass|
16 17 18
          handler = klass.new(mail, mail_key)
          break handler if handler.can_handle?
        end
19 20 21 22
      end
    end
  end
end