Module: JobStatus::Status
- Defined in:
- lib/job_status/status.rb
Overview
Status Module, retrieve the status information from the store
Class Method Summary collapse
-
.at(job_id) ⇒ Integer
Get the current progress from the store.
-
.get_all(job_id) ⇒ Object
Get the All Data from the store.
-
.get_status(job_id) ⇒ Symbol
Get the Status from the store.
- .percentage(job_id) ⇒ Object
-
.store(job_id) ⇒ Object
Get the stored data from the store.
-
.total(job_id) ⇒ Integer
Get the Total from the store.
Class Method Details
.at(job_id) ⇒ Integer
Get the current progress from the store
24 25 26 27 |
# File 'lib/job_status/status.rb', line 24 def self.at(job_id) status = JobStatus.store.fetch(job_id) status ? status[:at] : nil end |
.get_all(job_id) ⇒ Object
Get the All Data from the store
67 68 69 70 |
# File 'lib/job_status/status.rb', line 67 def self.get_all(job_id) status = JobStatus.store.fetch(job_id) status ? status : nil end |
.get_status(job_id) ⇒ Symbol
Get the Status from the store
13 14 15 16 |
# File 'lib/job_status/status.rb', line 13 def self.get_status(job_id) status = JobStatus.store.fetch(job_id) status ? status[:status] : nil end |
.percentage(job_id) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/job_status/status.rb', line 51 def self.percentage(job_id) status = JobStatus.store.fetch(job_id) percent = nil puts status if status percent = 100.0 / (status[:total].to_f / status[:at]) end return percent end |