Class: BranchTasks::Sequence

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

Direct Known Subclasses

RandomSequence

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/sequence.rb', line 3

def current_child_idx
  @current_child_idx
end

Instance Method Details

#child_failObject



27
28
29
# File 'lib/behave_fun/branch_tasks/sequence.rb', line 27

def child_fail
  fail
end

#child_runningObject



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

def child_running
  running
end

#child_successObject



18
19
20
21
22
23
24
25
# File 'lib/behave_fun/branch_tasks/sequence.rb', line 18

def child_success
  @current_child_idx += 1
  if @current_child_idx >= children.size
    success
  else
    run
  end
end

#executeObject



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

def execute
  @children[@current_child_idx].run
end

#serializable_status_fieldsObject



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

def serializable_status_fields
  [:current_child_idx]
end

#startObject



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

def start
  super
  @current_child_idx = 0
end