Class: Workhorse::Jobs::RunActiveJob
- Inherits:
-
Object
- Object
- Workhorse::Jobs::RunActiveJob
- Defined in:
- lib/workhorse/jobs/run_active_job.rb
Overview
Wrapper job for executing ActiveJob instances within Workhorse. This job handles the deserialization and execution of ActiveJob jobs that have been enqueued through the Workhorse adapter.
Instance Attribute Summary collapse
-
#job_data ⇒ Hash
readonly
Serialized ActiveJob data.
Instance Method Summary collapse
-
#initialize(job_data) ⇒ RunActiveJob
constructor
Creates a new ActiveJob wrapper.
-
#job_class ⇒ Class?
Returns the ActiveJob class for this job.
-
#perform ⇒ void
Executes the wrapped ActiveJob.
Constructor Details
#initialize(job_data) ⇒ RunActiveJob
Creates a new ActiveJob wrapper.
16 17 18 |
# File 'lib/workhorse/jobs/run_active_job.rb', line 16 def initialize(job_data) @job_data = job_data end |
Instance Attribute Details
#job_data ⇒ Hash (readonly)
Returns Serialized ActiveJob data.
11 12 13 |
# File 'lib/workhorse/jobs/run_active_job.rb', line 11 def job_data @job_data end |
Instance Method Details
#job_class ⇒ Class?
Returns the ActiveJob class for this job.
23 24 25 |
# File 'lib/workhorse/jobs/run_active_job.rb', line 23 def job_class @job_data['job_class'].safe_constantize end |
#perform ⇒ void
This method returns an undefined value.
Executes the wrapped ActiveJob.
30 31 32 |
# File 'lib/workhorse/jobs/run_active_job.rb', line 30 def perform ActiveJob::Base.execute(@job_data) end |