Class: Delayed::JobTracking
- Inherits:
-
Struct
- Object
- Struct
- Delayed::JobTracking
- Defined in:
- lib/delayed/job_tracking.rb
Overview
lot more about what’s going on in Delayed Jobs as it’s needed.
Instance Attribute Summary collapse
-
#created ⇒ Object
Returns the value of attribute created.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ JobTracking
constructor
A new instance of JobTracking.
- #job_created(job) ⇒ Object
Constructor Details
#initialize ⇒ JobTracking
Returns a new instance of JobTracking.
25 26 27 28 29 |
# File 'lib/delayed/job_tracking.rb', line 25 def initialize super self.created = [] @lock = Mutex.new end |
Instance Attribute Details
#created ⇒ Object
Returns the value of attribute created
7 8 9 |
# File 'lib/delayed/job_tracking.rb', line 7 def created @created end |
Class Method Details
.job_created(job) ⇒ Object
16 17 18 |
# File 'lib/delayed/job_tracking.rb', line 16 def self.job_created(job) @current_tracking.try(:job_created, job) end |
.track ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/delayed/job_tracking.rb', line 8 def self.track @current_tracking = self.new yield tracking = @current_tracking @current_tracking = nil tracking end |
Instance Method Details
#job_created(job) ⇒ Object
20 21 22 23 |
# File 'lib/delayed/job_tracking.rb', line 20 def job_created(job) return unless job @lock.synchronize { self.created << job } end |