Class: BranchTasks::DynamicGuardSelector

Inherits:
Task
  • Object
show all
Defined in:
lib/behave_fun/branch_tasks/dynamic_guard_selector.rb

Instance Method Summary collapse

Instance Method Details

#child_failObject



26
27
28
# File 'lib/behave_fun/branch_tasks/dynamic_guard_selector.rb', line 26

def child_fail
  fail
end

#child_runningObject



18
19
20
# File 'lib/behave_fun/branch_tasks/dynamic_guard_selector.rb', line 18

def child_running
  running
end

#child_successObject



22
23
24
# File 'lib/behave_fun/branch_tasks/dynamic_guard_selector.rb', line 22

def child_success
  success
end

#executeObject



3
4
5
6
7
8
9
10
11
# File 'lib/behave_fun/branch_tasks/dynamic_guard_selector.rb', line 3

def execute
  child = @children.find { _1.guard_passed? }
  if @current_child != child
    @current_child.cancel if @current_child
    @current_child = child
    @current_child.reset
  end
  @current_child.run
end

#startObject



13
14
15
16
# File 'lib/behave_fun/branch_tasks/dynamic_guard_selector.rb', line 13

def start
  super
  @current_child = nil
end