Class: JobBoard::JobPresenter
- Inherits:
-
Object
- Object
- JobBoard::JobPresenter
- Defined in:
- app/models/job_board/job_presenter.rb
Overview
Detail-page wrapper around a SolidQueue::Job loaded with all five has_one execution associations preloaded.
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
Instance Method Summary collapse
- #arguments ⇒ Object
- #enqueued_at ⇒ Object
- #error ⇒ Object
- #exception_executions ⇒ Object
- #executions_count ⇒ Object
-
#initialize(job) ⇒ JobPresenter
constructor
A new instance of JobPresenter.
-
#payload ⇒ Object
The serialized ActiveJob payload (Job#arguments is JSON-coded by SolidQueue).
- #process ⇒ Object
- #scheduled_at ⇒ Object
Constructor Details
#initialize(job) ⇒ JobPresenter
Returns a new instance of JobPresenter.
11 12 13 |
# File 'app/models/job_board/job_presenter.rb', line 11 def initialize(job) @job = job end |
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
5 6 7 |
# File 'app/models/job_board/job_presenter.rb', line 5 def job @job end |
Instance Method Details
#arguments ⇒ Object
22 |
# File 'app/models/job_board/job_presenter.rb', line 22 def arguments = payload["arguments"] |
#enqueued_at ⇒ Object
25 |
# File 'app/models/job_board/job_presenter.rb', line 25 def enqueued_at = payload["enqueued_at"] |
#error ⇒ Object
31 |
# File 'app/models/job_board/job_presenter.rb', line 31 def error = failed_execution |
#exception_executions ⇒ Object
24 |
# File 'app/models/job_board/job_presenter.rb', line 24 def exception_executions = payload["exception_executions"] |
#executions_count ⇒ Object
23 |
# File 'app/models/job_board/job_presenter.rb', line 23 def executions_count = payload["executions"] |
#payload ⇒ Object
The serialized ActiveJob payload (Job#arguments is JSON-coded by SolidQueue).
16 17 18 19 20 |
# File 'app/models/job_board/job_presenter.rb', line 16 def payload @payload ||= job.arguments || {} rescue StandardError @payload = {} end |
#process ⇒ Object
33 34 35 |
# File 'app/models/job_board/job_presenter.rb', line 33 def process job.claimed_execution&.process end |
#scheduled_at ⇒ Object
27 28 29 |
# File 'app/models/job_board/job_presenter.rb', line 27 def scheduled_at job.scheduled_execution&.scheduled_at || job.scheduled_at end |