class Dynflow::Testing::DummyExecutor

Attributes

world[R]

Public Class Methods

new(world) click to toggle source
# File lib/dynflow/testing/dummy_executor.rb, line 6
def initialize(world)
  @world             = world
  @events_to_process = []
end

Public Instance Methods

clear() click to toggle source
# File lib/dynflow/testing/dummy_executor.rb, line 28
def clear
  @events_to_process.clear
end
event(execution_plan_id, step_id, event, future = Concurrent.future) click to toggle source
# File lib/dynflow/testing/dummy_executor.rb, line 11
def event(execution_plan_id, step_id, event, future = Concurrent.future)
  @events_to_process << [execution_plan_id, step_id, event, future]
end
progress() click to toggle source

returns true if some event was processed.

# File lib/dynflow/testing/dummy_executor.rb, line 16
def progress
  events = @events_to_process.dup
  clear
  events.each do |execution_plan_id, step_id, event, future|
    future.success true
    if event && world.action.state != :suspended
      return false
    end
    world.action.execute event
  end
end