# frozen_string_literal: true module AbstractNotifier module AsyncAdapters class ActiveJob class DeliveryJob < ::ActiveJob::Base def perform(notifier_class, *__rest__, &__block__) AbstractNotifier::NotificationDelivery.new(notifier_class.constantize, *__rest__, &__block__).notify_now end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :perform) end DEFAULT_QUEUE = "notifiers" attr_reader :job def initialize(queue: DEFAULT_QUEUE, job: DeliveryJob) @job = job.set(queue: queue) end def enqueue(...) job.perform_later(...) end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :enqueue) end end end AbstractNotifier.async_adapter ||= :active_job