Class: BranchTasks::Selector

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

Direct Known Subclasses

RandomSelector

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_child_idxObject

Returns the value of attribute current_child_idx.



3
4
5
# File 'lib/behave_fun/branch_tasks/selector.rb', line 3

def current_child_idx
  @current_child_idx
end

Instance Method Details

#child_failObject



22
23
24
25
26
27
28
29
# File 'lib/behave_fun/branch_tasks/selector.rb', line 22

def child_fail
  @current_child_idx += 1
  if @current_child_idx >= children.size
    fail
  else
    run
  end
end

#child_runningObject



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

def child_running
  running
end

#child_successObject



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

def child_success
  success
end

#executeObject



5
6
7
# File 'lib/behave_fun/branch_tasks/selector.rb', line 5

def execute
  @children[@current_child_idx].run
end

#serializable_status_fieldsObject



31
32
33
# File 'lib/behave_fun/branch_tasks/selector.rb', line 31

def serializable_status_fields
  [:current_child_idx]
end

#startObject



9
10
11
12
# File 'lib/behave_fun/branch_tasks/selector.rb', line 9

def start
  super
  @current_child_idx = 0
end