Class: BranchTasks::RandomSequence

Inherits:
Sequence
  • Object
show all
Defined in:
lib/behave_fun/branch_tasks/random_sequence.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#orderObject

Returns the value of attribute order.



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

def order
  @order
end

Instance Method Details

#executeObject



5
6
7
8
9
# File 'lib/behave_fun/branch_tasks/random_sequence.rb', line 5

def execute
  @order = (0...@children.size).to_a.shuffle unless @order

  @children[@order[@current_child_idx]].run
end

#serializable_status_fieldsObject



16
17
18
# File 'lib/behave_fun/branch_tasks/random_sequence.rb', line 16

def serializable_status_fields
  [:current_child_idx, :order]
end

#startObject



11
12
13
14
# File 'lib/behave_fun/branch_tasks/random_sequence.rb', line 11

def start
  super
  @order = nil
end