Sha256: c8b53892fa6cd060928efe58f3693bdb75ee4c9d70780a29dd0f2367f679addb

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true

module ActiveDelivery
  module Lines
    class Mailer < Base
      alias_method :mailer_class, :handler_class

      DEFAULT_RESOLVER = ->(name) { name.gsub(/Delivery$/, "Mailer").safe_constantize }

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

      def notify_now(mailer, mid, *__rest__, &__block__)
        mailer.public_send(mid, *__rest__, &__block__).deliver_now
      end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :notify_now)

      def notify_later(mailer, mid, *__rest__, &__block__)
        mailer.public_send(mid, *__rest__, &__block__).deliver_later
      end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :notify_later)
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_delivery-1.0.0.rc2 lib/.rbnext/3.0/active_delivery/lines/mailer.rb