Module: ActiveBatch::BatchedJob

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_batch/batched_job.rb

Instance Method Summary collapse

Instance Method Details

#in_batch?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/active_batch/batched_job.rb', line 15

def in_batch?
  work_unit_in_batch(self)
end

#save_result(result) ⇒ Object



11
12
13
# File 'lib/active_batch/batched_job.rb', line 11

def save_result(result)
  work_unit_in_batch(self).update!(work_result: result.to_s) if in_batch?
end

#work_unit_in_batch(job) ⇒ Object



7
8
9
# File 'lib/active_batch/batched_job.rb', line 7

def work_unit_in_batch(job)
  WorkUnit.find_by(job_id: job.job_id)
end