aboutsummaryrefslogblamecommitdiffstats
path: root/lib/active_job/base.rb
blob: d3b0fcffa8a9157b914ff2b06ac990ef0b53e7b3 (plain) (tree)
1
2
3
4
5
6
7
8
                                  
                                                  
                                                    
 

                

                       


                                                        

                        
                                       
         
 


                                                           
       

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

module ActiveJob
  class Base
    extend QueueAdapter

    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
    end
  end
end