diff options
Diffstat (limited to 'lib/active_job')
-rw-r--r-- | lib/active_job/base.rb | 17 | ||||
-rw-r--r-- | lib/active_job/queue_name.rb | 10 |
2 files changed, 14 insertions, 13 deletions
diff --git a/lib/active_job/base.rb b/lib/active_job/base.rb index d3b0fcffa8..fe3d1677dd 100644 --- a/lib/active_job/base.rb +++ b/lib/active_job/base.rb @@ -1,22 +1,13 @@ require 'active_job/queue_adapter' -require 'active_job/queue_adapters/inline_adapter' -require 'active_support/core_ext/string/inflections' +require 'active_job/queue_name' module ActiveJob class Base extend QueueAdapter + extend QueueName - cattr_accessor(:queue_base_name) { "active_jobs" } - cattr_accessor(:queue_name) { queue_base_name } - - class << self - def enqueue(*args) - queue_adapter.queue self, *args - end - - def queue_as(part_name) - self.queue_name = "#{queue_base_name}_#{part_name}" - end + def self.enqueue(*args) + queue_adapter.queue self, *args end end end
\ No newline at end of file diff --git a/lib/active_job/queue_name.rb b/lib/active_job/queue_name.rb new file mode 100644 index 0000000000..a606b67370 --- /dev/null +++ b/lib/active_job/queue_name.rb @@ -0,0 +1,10 @@ +module ActiveJob + module QueueName + mattr_accessor(:queue_base_name) { "active_jobs" } + mattr_accessor(:queue_name) { queue_base_name } + + def queue_as(part_name) + self.queue_name = "#{queue_base_name}_#{part_name}" + end + end +end
\ No newline at end of file |