Class: ChainedJob::Process
- Inherits:
-
Object
- Object
- ChainedJob::Process
- Defined in:
- lib/chained_job/process.rb
Instance Attribute Summary collapse
-
#job_instance ⇒ Object
readonly
Returns the value of attribute job_instance.
-
#job_tag ⇒ Object
readonly
Returns the value of attribute job_tag.
-
#worker_id ⇒ Object
readonly
Returns the value of attribute worker_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(job_instance, worker_id, job_tag) ⇒ Process
constructor
A new instance of Process.
- #run ⇒ Object
Constructor Details
#initialize(job_instance, worker_id, job_tag) ⇒ Process
Returns a new instance of Process.
13 14 15 16 17 |
# File 'lib/chained_job/process.rb', line 13 def initialize(job_instance, worker_id, job_tag) @job_instance = job_instance @worker_id = worker_id @job_tag = job_tag end |
Instance Attribute Details
#job_instance ⇒ Object (readonly)
Returns the value of attribute job_instance.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def job_instance @job_instance end |
#job_tag ⇒ Object (readonly)
Returns the value of attribute job_tag.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def job_tag @job_tag end |
#worker_id ⇒ Object (readonly)
Returns the value of attribute worker_id.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def worker_id @worker_id end |
Class Method Details
.run(job_instance, worker_id, job_tag) ⇒ Object
7 8 9 |
# File 'lib/chained_job/process.rb', line 7 def self.run(job_instance, worker_id, job_tag) new(job_instance, worker_id, job_tag).run end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/chained_job/process.rb', line 19 def run with_hooks do return finished_worker unless argument job_instance.process(argument) job_instance.class.perform_later(worker_id, job_tag) end end |