Class: Workhorse::Jobs::RunRailsOp
- Inherits:
-
Object
- Object
- Workhorse::Jobs::RunRailsOp
- Defined in:
- lib/workhorse/jobs/run_rails_op.rb
Overview
Job wrapper for executing Rails operations (trailblazer-operation or similar). This job allows enqueuing of operation classes with parameters for later execution.
Instance Method Summary collapse
-
#initialize(cls, params = {}) ⇒ RunRailsOp
constructor
Creates a new Rails operation job.
-
#job_class ⇒ Class
Returns the operation class for this job.
-
#perform ⇒ void
Executes the Rails operation with the provided parameters.
Constructor Details
#initialize(cls, params = {}) ⇒ RunRailsOp
Creates a new Rails operation job.
16 17 18 19 |
# File 'lib/workhorse/jobs/run_rails_op.rb', line 16 def initialize(cls, params = {}) @cls = cls @params = params end |
Instance Method Details
#job_class ⇒ Class
Returns the operation class for this job.
24 25 26 |
# File 'lib/workhorse/jobs/run_rails_op.rb', line 24 def job_class @cls end |
#perform ⇒ void
This method returns an undefined value.
Executes the Rails operation with the provided parameters.
31 32 33 |
# File 'lib/workhorse/jobs/run_rails_op.rb', line 31 def perform @cls.run!(@params) end |