Sha256: d040fd3aa9a570c7dfb3fe42cc8d4d4e0339a91bfe6ca465f99b07809929b426

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

require "global_id/railtie"
require "active_job"

module ActiveJob
  # = Active Job Railtie
  class Railtie < Quails::Railtie # :nodoc:
    config.active_job = ActiveSupport::OrderedOptions.new

    initializer "active_job.logger" do
      ActiveSupport.on_load(:active_job) { self.logger = ::Quails.logger }
    end

    initializer "active_job.set_configs" do |app|
      options = app.config.active_job
      options.queue_adapter ||= :async

      ActiveSupport.on_load(:active_job) do
        options.each { |k, v| send("#{k}=", v) }
      end
    end

    initializer "active_job.set_reloader_hook" do |app|
      ActiveSupport.on_load(:active_job) do
        ActiveJob::Callbacks.singleton_class.set_callback(:execute, :around, prepend: true) do |_, inner|
          app.reloader.wrap do
            inner.call
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activejob/lib/active_job/railtie.rb