module ActiveJob::QueueAdapter::ClassMethods
Includes the setter method for changing the active queue adapter.
Constants
- QUEUE_ADAPTER_METHODS
Public Instance Methods
queue_adapter()
click to toggle source
Returns the backend queue provider. The default queue adapter is the
:async
queue. See QueueAdapters for more information.
# File lib/active_job/queue_adapter.rb, line 18 def queue_adapter _queue_adapter end
queue_adapter=(name_or_adapter_or_class)
click to toggle source
Specify the backend queue provider. The default queue adapter is the
:async
queue. See QueueAdapters for more information.
# File lib/active_job/queue_adapter.rb, line 25 def queue_adapter=(name_or_adapter_or_class) self._queue_adapter = interpret_adapter(name_or_adapter_or_class) end
Private Instance Methods
interpret_adapter(name_or_adapter_or_class)
click to toggle source
# File lib/active_job/queue_adapter.rb, line 31 def interpret_adapter(name_or_adapter_or_class) case name_or_adapter_or_class when Symbol, String ActiveJob::QueueAdapters.lookup(name_or_adapter_or_class).new else if queue_adapter?(name_or_adapter_or_class) name_or_adapter_or_class else raise ArgumentError end end end
queue_adapter?(object)
click to toggle source
# File lib/active_job/queue_adapter.rb, line 46 def queue_adapter?(object) QUEUE_ADAPTER_METHODS.all? { |meth| object.respond_to?(meth) } end