mcordell/grape_token_auth

View on GitHub
lib/grape_token_auth/mail/mail.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
module GrapeTokenAuth
  module Mail
    DEFAULT_MESSAGES = {
      reset_password_instructions: PasswordResetEmail,
      confirmation_instructions: ConfirmationEmail
    }

    class << self
      def initialize_message(message_type, opts)
        messages = GrapeTokenAuth.configuration.messages
        return nil unless messages.key?(message_type)
        messages[message_type].new(opts)
      end
    end
  end
end