Sha256: 446eb15c4e31b7b2278f85828ff7cb082bcac3b7ef152bbfba29fe56b15aa081

Contents?: true

Size: 758 Bytes

Versions: 3

Compression:

Stored size: 758 Bytes

Contents

require 'active_job/queue_adapters/inline_adapter'
require 'active_support/core_ext/string/inflections'

module ActiveJob
  module QueueAdapter
    extend ActiveSupport::Concern

    module ClassMethods
      mattr_reader(:queue_adapter) { ActiveJob::QueueAdapters::InlineAdapter }

      def queue_adapter=(name_or_adapter)
        @@queue_adapter = \
          case name_or_adapter
          when :test
            ActiveJob::QueueAdapters::TestAdapter.new
          when Symbol, String
            load_adapter(name_or_adapter)
          when Class
            name_or_adapter
          end
      end

      private
        def load_adapter(name)
          "ActiveJob::QueueAdapters::#{name.to_s.camelize}Adapter".constantize
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
activejob-4.2.0.beta3 lib/active_job/queue_adapter.rb
activejob-4.2.0.beta2 lib/active_job/queue_adapter.rb
activejob_backport-0.0.1 lib/active_job/queue_adapter.rb