class Sidekiq::TrackableBatch::Workflow
@api private
Attributes
stages[R]
Public Class Methods
new(enclosing_batch)
click to toggle source
# File lib/sidekiq/trackable_batch/workflow.rb, line 8 def initialize(enclosing_batch) @enclosing_batch = enclosing_batch @stages = [] end
Public Instance Methods
<<(stage)
click to toggle source
# File lib/sidekiq/trackable_batch/workflow.rb, line 13 def <<(stage) @stages << stage end
setup(&block)
click to toggle source
# File lib/sidekiq/trackable_batch/workflow.rb, line 25 def setup(&block) @enclosing_batch.instance_eval(&block) setup_callbacks setup_jobs end
stage(name)
click to toggle source
# File lib/sidekiq/trackable_batch/workflow.rb, line 17 def stage(name) @stages.detect { |stage| stage.description == name } end
start()
click to toggle source
# File lib/sidekiq/trackable_batch/workflow.rb, line 21 def start Sidekiq::Client.new.raw_push(@stages.first.job_list) end
Private Instance Methods
setup_callbacks()
click to toggle source
# File lib/sidekiq/trackable_batch/workflow.rb, line 41 def setup_callbacks @stages.each_cons(2) do |stage, next_stage| stage.on(:success, SuccessCallback, next_stage.bid) end end
setup_jobs()
click to toggle source
# File lib/sidekiq/trackable_batch/workflow.rb, line 33 def setup_jobs @enclosing_batch.jobs do @stages.each do |stage| stage.setup(@enclosing_batch) end end end