module ChainedJob::Middleware
Public Class Methods
included(base)
click to toggle source
# File lib/chained_job/middleware.rb, line 8 def self.included(base) base.queue_as ChainedJob.config.queue if ChainedJob.config.queue end
Public Instance Methods
arguments_array(args)
click to toggle source
# File lib/chained_job/middleware.rb, line 24 def arguments_array(args) options = { job_class: self.class, args: args } ChainedJob.config.around_array_of_job_arguments.call(options) { array_of_job_arguments } end
array_of_job_arguments()
click to toggle source
# File lib/chained_job/middleware.rb, line 29 def array_of_job_arguments raise NoMethodError, 'undefined method array_of_job_arguments' end
job_arguments_key()
click to toggle source
# File lib/chained_job/middleware.rb, line 37 def job_arguments_key self.class end
parallelism()
click to toggle source
# File lib/chained_job/middleware.rb, line 33 def parallelism raise NoMethodError, 'undefined method parallelism' end
perform(args = {}, worker_id = nil, tag = nil)
click to toggle source
# File lib/chained_job/middleware.rb, line 12 def perform(args = {}, worker_id = nil, tag = nil) unless Hash === args # backward compatibility args, worker_id, tag = {}, args, worker_id end if worker_id ChainedJob::Process.run(args, self, job_arguments_key, worker_id, tag) else ChainedJob::StartChains.run(args, self.class, job_arguments_key, arguments_array(args), parallelism) end end