Class: ActiveJob::Status::Status
- Inherits:
-
Object
- Object
- ActiveJob::Status::Status
- Defined in:
- lib/activejob-status/status.rb
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
- #delete ⇒ Object
-
#initialize(job) ⇒ Status
constructor
A new instance of Status.
- #job_id ⇒ Object
- #present? ⇒ Boolean
- #progress ⇒ Object
- #read ⇒ Object
- #status ⇒ Object
- #status_inquiry ⇒ Object
- #update(message) ⇒ Object
Constructor Details
#initialize(job) ⇒ Status
Returns a new instance of Status.
6 7 8 |
# File 'lib/activejob-status/status.rb', line 6 def initialize(job) @job = job end |
Instance Method Details
#[]=(key, value) ⇒ Object
10 11 12 |
# File 'lib/activejob-status/status.rb', line 10 def []= key, value update(key => value) end |
#delete ⇒ Object
22 23 24 |
# File 'lib/activejob-status/status.rb', line 22 def delete Storage.delete(@job) end |
#job_id ⇒ Object
26 27 28 |
# File 'lib/activejob-status/status.rb', line 26 def job_id Storage.job_id(@job) end |
#present? ⇒ Boolean
38 39 40 |
# File 'lib/activejob-status/status.rb', line 38 def present? read.present? end |
#progress ⇒ Object
34 35 36 |
# File 'lib/activejob-status/status.rb', line 34 def progress read[:progress].to_f / read[:total].to_f end |
#read ⇒ Object
14 15 16 |
# File 'lib/activejob-status/status.rb', line 14 def read Storage.read(@job) end |
#status ⇒ Object
30 31 32 |
# File 'lib/activejob-status/status.rb', line 30 def status read[:status] end |
#status_inquiry ⇒ Object
42 43 44 |
# File 'lib/activejob-status/status.rb', line 42 def status_inquiry status.to_s.inquiry end |