Module: AngryBatch::Batchable
- Defined in:
- lib/angry_batch/batchable.rb
Instance Attribute Summary collapse
-
#angry_batch_id ⇒ Object
Returns the value of attribute angry_batch_id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#angry_batch_id ⇒ Object
Returns the value of attribute angry_batch_id.
14 15 16 |
# File 'lib/angry_batch/batchable.rb', line 14 def angry_batch_id @angry_batch_id end |
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/angry_batch/batchable.rb', line 4 def self.included(base) base.after_perform do |job| AngryBatch::Handle.job_completed(job) end base.after_discard do |job, exception| AngryBatch::Handle.job_failed(job, exception) end end |
Instance Method Details
#batch ⇒ Object
25 26 27 28 29 |
# File 'lib/angry_batch/batchable.rb', line 25 def batch return @batch if defined?(@batch) @batch = angry_batch_id && AngryBatch::Batch.find_by(id: angry_batch_id) end |
#deserialize(job_data) ⇒ Object
20 21 22 23 |
# File 'lib/angry_batch/batchable.rb', line 20 def deserialize(job_data) super self.angry_batch_id = job_data['angry_batch_id'] end |
#serialize ⇒ Object
16 17 18 |
# File 'lib/angry_batch/batchable.rb', line 16 def serialize super.merge('angry_batch_id' => angry_batch_id) end |