Class: Operationable::Runners::Serial

Inherits:
Base
  • Object
show all
Defined in:
lib/operationable/runners/serial.rb

Instance Attribute Summary

Attributes inherited from Base

#callbacks, #params, #record, #result, #user

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#check_status?, #ensure_enqueue, #initialize, #job_async_execute_method, #job_class, #job_sync_execute_method, #persist?, #store_callback

Constructor Details

This class inherits a constructor from Operationable::Runners::Base

Class Method Details

.call(q_options:, props:) ⇒ Object



16
17
18
19
# File 'lib/operationable/runners/serial.rb', line 16

def self.call(q_options:, props:)
  instance = q_options[:callback_class_name].constantize.new(props)
  q_options[:callback_names].each { |method_name| instance.method(method_name).call }
end

Instance Method Details

#processObject



9
10
11
12
13
14
# File 'lib/operationable/runners/serial.rb', line 9

def process
  (queue.blank? ? self.class : job_class.to_s.constantize.method(perform_method)).call(
    q_options: q_options,
    props: props
  )
end

#q_optionsObject



21
22
23
24
25
26
# File 'lib/operationable/runners/serial.rb', line 21

def q_options
  store_callback({ type: 'serial',
    callback_class_name: callback_class_name,
    callback_names: callback_names,
    queue: queue })
end

#runObject



5
6
7
# File 'lib/operationable/runners/serial.rb', line 5

def run
  process
end