Sha256: b4596ff77380726c661b8f741eeecce468d2eca350b5343249b33d5f2c32aaac

Contents?: true

Size: 716 Bytes

Versions: 3

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

if ActionMailer::VERSION::MAJOR < 5
  require "active_delivery/action_mailer/parameterized"
end

module ActiveDelivery
  module Lines
    class Mailer < Base
      alias mailer_class handler_class

      def resolve_class(name)
        name.gsub(/Delivery$/, "Mailer").safe_constantize
      end

      def notify?(method_name)
        mailer_class.action_methods.include?(method_name.to_s)
      end

      def notify_now(mailer, mid, *args)
        mailer.public_send(mid, *args).deliver_now
      end

      def notify_later(mailer, mid, *args)
        mailer.public_send(mid, *args).deliver_later
      end
    end

    ActiveDelivery::Base.register_line :mailer, Mailer
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_delivery-0.3.1 lib/active_delivery/lines/mailer.rb
active_delivery-0.3.0 lib/active_delivery/lines/mailer.rb
active_delivery-0.2.1 lib/active_delivery/lines/mailer.rb