class SidekiqWorkflows::WorkerNode
Attributes
children[R]
on_partial_complete[RW]
parent[R]
workers[RW]
workflow_uuid[RW]
Public Class Methods
new(workers:, workflow_uuid: nil, on_partial_complete: nil, parent: nil)
click to toggle source
# File lib/sidekiq_workflows/worker_node.rb, line 12 def initialize(workers:, workflow_uuid: nil, on_partial_complete: nil, parent: nil) @workers = workers.each do |entry| entry[:worker] = ActiveSupport::Inflector.constantize(entry[:worker]) if entry[:worker].is_a?(String) entry[:delay] = entry[:delay].to_i if entry[:delay] end @workflow_uuid = workflow_uuid @on_partial_complete = on_partial_complete @parent = parent @children = [] end
Public Instance Methods
to_h()
click to toggle source
# File lib/sidekiq_workflows/worker_node.rb, line 23 def to_h { workers: workers.map do |entry| { worker: entry[:worker].name, payload: entry[:payload], delay: entry[:delay] } end, workflow_uuid: workflow_uuid, on_partial_complete: on_partial_complete, children: @children.map(&:to_h) } end