class SidekiqWebWorkers::JobRunner
Attributes
worker_name[R]
Public Class Methods
execute!(*args)
click to toggle source
# File lib/sidekiq-web-workers/job_runner.rb, line 5 def self.execute!(*args) new(*args).execute! end
new(worker_name:, worker_parameters:, perform_in: nil)
click to toggle source
# File lib/sidekiq-web-workers/job_runner.rb, line 9 def initialize(worker_name:, worker_parameters:, perform_in: nil) @worker_name = worker_name @worker_parameters = worker_parameters @perform_in = perform_in end
Public Instance Methods
execute!()
click to toggle source
# File lib/sidekiq-web-workers/job_runner.rb, line 15 def execute! enqueue_worker end
Private Instance Methods
arguments_array()
click to toggle source
# File lib/sidekiq-web-workers/job_runner.rb, line 27 def arguments_array # {param_name: param_value,....} @worker_parameters .values # sidekiq perform_async only takes the values not named params .map{|i| i.present? ? i : nil} # convert empty strings into nil end
enqueue_worker()
click to toggle source
# File lib/sidekiq-web-workers/job_runner.rb, line 19 def enqueue_worker args = arguments_array if @perform_in.present? worker.perform_in(@perform_in.to_i.minutes, *args) else worker.perform_async(*args) end end
worker()
click to toggle source
# File lib/sidekiq-web-workers/job_runner.rb, line 34 def worker worker_name.constantize end