diff options
-rw-r--r-- | activejob/lib/active_job/queue_adapter.rb | 6 | ||||
-rw-r--r-- | activejob/lib/active_job/queue_adapters.rb | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/activejob/lib/active_job/queue_adapter.rb b/activejob/lib/active_job/queue_adapter.rb index e1f104dc60..9c4519432d 100644 --- a/activejob/lib/active_job/queue_adapter.rb +++ b/activejob/lib/active_job/queue_adapter.rb @@ -31,7 +31,7 @@ module ActiveJob def interpret_adapter(name_or_adapter_or_class) case name_or_adapter_or_class when Symbol, String - load_adapter(name_or_adapter_or_class) + ActiveJob::QueueAdapters.lookup(name_or_adapter_or_class).new else if queue_adapter?(name_or_adapter_or_class) name_or_adapter_or_class @@ -56,10 +56,6 @@ module ActiveJob def queue_adapter_class?(object) object.is_a?(Class) && QUEUE_ADAPTER_METHODS.all? { |meth| object.public_method_defined?(meth) } end - - def load_adapter(name) - ActiveJob::QueueAdapters.const_get(name.to_s.camelize + 'Adapter').new - end end end end diff --git a/activejob/lib/active_job/queue_adapters.rb b/activejob/lib/active_job/queue_adapters.rb index 4b91c93dbe..29f28963b4 100644 --- a/activejob/lib/active_job/queue_adapters.rb +++ b/activejob/lib/active_job/queue_adapters.rb @@ -48,5 +48,13 @@ module ActiveJob autoload :SneakersAdapter autoload :SuckerPunchAdapter autoload :TestAdapter + + ADAPTER = 'Adapter'.freeze + + class << self + def lookup(name) + const_get(name.to_s.camelize << ADAPTER) + end + end end end |