Class: Dynflow::Testing::DummyExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/dynflow/testing/dummy_executor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(world) ⇒ DummyExecutor

Returns a new instance of DummyExecutor.



6
7
8
9
# File 'lib/dynflow/testing/dummy_executor.rb', line 6

def initialize(world)
  @world             = world
  @events_to_process = []
end

Instance Attribute Details

#worldObject (readonly)

Returns the value of attribute world.



4
5
6
# File 'lib/dynflow/testing/dummy_executor.rb', line 4

def world
  @world
end

Instance Method Details

#clearObject



24
25
26
# File 'lib/dynflow/testing/dummy_executor.rb', line 24

def clear
  @events_to_process.clear
end

#event(execution_plan_id, step_id, event, future = Future.new) ⇒ Object



11
12
13
# File 'lib/dynflow/testing/dummy_executor.rb', line 11

def event(execution_plan_id, step_id, event, future = Future.new)
  @events_to_process << [execution_plan_id, step_id, event, future]
end

#progressObject



15
16
17
18
19
20
21
22
# File 'lib/dynflow/testing/dummy_executor.rb', line 15

def progress
  events = @events_to_process.dup
  clear
  events.each do |execution_plan_id, step_id, event, future|
    future.resolve true
    world.action.execute event
  end
end