Class: Spotlight::BackgroundJobProgress
- Inherits:
-
Object
- Object
- Spotlight::BackgroundJobProgress
- Defined in:
- app/models/spotlight/background_job_progress.rb
Overview
BackgroundJobProgress is a class that models the progress of a list of resources
Instance Attribute Summary collapse
-
#exhibit ⇒ Object
readonly
Returns the value of attribute exhibit.
-
#job_class ⇒ Object
readonly
Returns the value of attribute job_class.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(exhibit, job_class:) ⇒ BackgroundJobProgress
constructor
A new instance of BackgroundJobProgress.
Constructor Details
#initialize(exhibit, job_class:) ⇒ BackgroundJobProgress
Returns a new instance of BackgroundJobProgress.
11 12 13 14 |
# File 'app/models/spotlight/background_job_progress.rb', line 11 def initialize(exhibit, job_class:) @exhibit = exhibit @job_class = job_class end |
Instance Attribute Details
#exhibit ⇒ Object (readonly)
Returns the value of attribute exhibit.
7 8 9 |
# File 'app/models/spotlight/background_job_progress.rb', line 7 def exhibit @exhibit end |
#job_class ⇒ Object (readonly)
Returns the value of attribute job_class.
7 8 9 |
# File 'app/models/spotlight/background_job_progress.rb', line 7 def job_class @job_class end |
Instance Method Details
#as_json ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/spotlight/background_job_progress.rb', line 16 def as_json(*) { recently_in_progress: recently_in_progress?, started_at: localized_start_time, finished_at: localized_finish_time, updated_at: localized_updated_time, total: [total, completed].max, completed: completed, finished: finished?, errored: errored? } end |