module SidekiqWorkflows

Attributes

callback_queue[RW]
worker_queue[RW]

Public Class Methods

build(workflow_uuid: nil, on_partial_complete: nil, except: [], &block) click to toggle source
# File lib/sidekiq_workflows.rb, line 29
def self.build(workflow_uuid: nil, on_partial_complete: nil, except: [], &block)
  root = RootNode.new(workflow_uuid: workflow_uuid, on_partial_complete: on_partial_complete)
  Builder.new(root, except).then(&block)
  root
end
deserialize(string) click to toggle source
# File lib/sidekiq_workflows.rb, line 16
def self.deserialize(string)
  from_h(JSON.parse(string, symbolize_names: true))
end
from_h(hash, parent = nil) click to toggle source
# File lib/sidekiq_workflows.rb, line 20
def self.from_h(hash, parent = nil)
  parent ||= hash.key?(:workers) ? WorkerNode.new(workflow_uuid: hash[:workflow_uuid], on_partial_complete: hash[:on_partial_complete], workers: hash[:workers]) : RootNode.new(workflow_uuid: hash[:workflow_uuid], on_partial_complete: hash[:on_partial_complete])
  hash[:children].each do |h|
    child = parent.add_group(h[:workers])
    from_h(h, child)
  end
  parent
end