module ActiveJob::QueueAdapter::ClassMethods

Includes the setter method for changing the active queue adapter.

Public Instance Methods

queue_adapter=(name_or_adapter) click to toggle source

Specify the backend queue provider. The default queue adapter is the :inline queue. See QueueAdapters for more information.

# File lib/active_job/queue_adapter.rb, line 17
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 Instance Methods

load_adapter(name) click to toggle source
# File lib/active_job/queue_adapter.rb, line 30
def load_adapter(name)
  "ActiveJob::QueueAdapters::#{name.to_s.camelize}Adapter".constantize
end