Class: Resque::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/plugins/access_worker_from_job.rb

Overview

Resque-AccessWorkerFromJob plugin overrides the Resque::Job#args method to pass the worker along as the last argument, if the class on which to call perform wants it.

Instance Method Summary collapse

Instance Method Details

#argsObject

Overridden args appends the worker when returning the list of args represented in this job’s payload.



9
10
11
12
13
# File 'lib/resque/plugins/access_worker_from_job.rb', line 9

def args
  base_args = @payload['args'] || []
  base_args << worker if payload_class.respond_to?(:wants_worker_access) && payload_class.wants_worker_access
  return base_args
end