Class: Dalliance::Workers::DelayedJob
- Inherits:
-
Struct
- Object
- Struct
- Dalliance::Workers::DelayedJob
- Defined in:
- lib/dalliance/workers/delayed_job.rb,
lib/dalliance/workers/delayed_job.rb
Instance Attribute Summary collapse
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
-
#instance_klass ⇒ Object
Returns the value of attribute instance_klass.
-
#perform_method ⇒ Object
Returns the value of attribute perform_method.
Class Method Summary collapse
- .enqueue(instance, queue = 'dalliance', perform_method) ⇒ Object
-
.rescue_error? ⇒ Boolean
Delayed job automatically retries, so rescue the error.
Instance Method Summary collapse
Instance Attribute Details
#instance_id ⇒ Object
Returns the value of attribute instance_id
26 27 28 |
# File 'lib/dalliance/workers/delayed_job.rb', line 26 def instance_id @instance_id end |
#instance_klass ⇒ Object
Returns the value of attribute instance_klass
26 27 28 |
# File 'lib/dalliance/workers/delayed_job.rb', line 26 def instance_klass @instance_klass end |
#perform_method ⇒ Object
Returns the value of attribute perform_method
26 27 28 |
# File 'lib/dalliance/workers/delayed_job.rb', line 26 def perform_method @perform_method end |
Class Method Details
.enqueue(instance, queue = 'dalliance', perform_method) ⇒ Object
7 8 9 10 11 |
# File 'lib/dalliance/workers/delayed_job.rb', line 7 def self.enqueue(instance, queue = 'dalliance', perform_method) Dalliance::Workers::DelayedJob .set(queue: queue) .perform_later(instance.class.name, instance.id, perform_method.to_s) end |
.rescue_error? ⇒ Boolean
Delayed job automatically retries, so rescue the error
21 22 23 |
# File 'lib/dalliance/workers/delayed_job.rb', line 21 def self.rescue_error? true end |
Instance Method Details
#perform ⇒ Object
13 14 15 16 17 18 |
# File 'lib/dalliance/workers/delayed_job.rb', line 13 def perform(instance_klass, instance_id, perform_method) instance_klass .constantize .find(instance_id) .send(perform_method, true) end |