Module: ActiveJobStore
- Defined in:
- lib/active_job_store/version.rb,
lib/active_job_store.rb,
lib/active_job_store/store.rb,
lib/active_job_store/engine.rb,
app/models/active_job_store/record.rb
Overview
:nocov:
Defined Under Namespace
Modules: ClassMethods Classes: Engine, Record, Store
Constant Summary collapse
- VERSION =
'0.5.0'
Instance Attribute Summary collapse
-
#active_job_store_custom_data ⇒ Object
Set / manipulate job’s custom data.
Class Method Summary collapse
Instance Method Summary collapse
-
#active_job_store_format_result(result) ⇒ any
Format / manipulate / serialize the job result.
-
#active_job_store_internal_error(context, exception) ⇒ Object
Internal errors handler method.
-
#active_job_store_record ⇒ ActiveJobStore::Record
Return the associated Active Job Store record.
-
#save_job_custom_data(custom_data = nil) ⇒ Object
Persist custom data while the job is performing.
Instance Attribute Details
#active_job_store_custom_data ⇒ Object
Set / manipulate job’s custom data
8 9 10 |
# File 'lib/active_job_store.rb', line 8 def active_job_store_custom_data @active_job_store_custom_data end |
Class Method Details
.included(base) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/active_job_store.rb', line 51 def included(base) base.extend(ClassMethods) base.around_enqueue do |job, block| store.around_enqueue(job) { block.call } end base.around_perform do |job, block| store.around_perform(job) { block.call } end end |
Instance Method Details
#active_job_store_format_result(result) ⇒ any
Format / manipulate / serialize the job result
15 16 17 |
# File 'lib/active_job_store.rb', line 15 def active_job_store_format_result(result) result end |
#active_job_store_internal_error(context, exception) ⇒ Object
Internal errors handler method
37 38 39 |
# File 'lib/active_job_store.rb', line 37 def active_job_store_internal_error(context, exception) warn("#{context}: #{exception}") end |
#active_job_store_record ⇒ ActiveJobStore::Record
Return the associated Active Job Store record
30 31 32 |
# File 'lib/active_job_store.rb', line 30 def active_job_store_record store.record end |
#save_job_custom_data(custom_data = nil) ⇒ Object
Persist custom data while the job is performing
22 23 24 25 |
# File 'lib/active_job_store.rb', line 22 def save_job_custom_data(custom_data = nil) self.active_job_store_custom_data = custom_data if custom_data store.update_job_custom_data(active_job_store_custom_data) end |