Class: Swarm::SequenceExpression

Inherits:
BranchExpression show all
Defined in:
lib/swarm/expressions/sequence_expression.rb

Instance Attribute Summary

Attributes inherited from HiveDweller

#hive, #id

Instance Method Summary collapse

Methods inherited from BranchExpression

#add_and_apply_child, #add_child, #create_child_expression, #kick_off_children

Methods inherited from Expression

#_apply, #_reply, #apply, #arguments, #branch_position, #command, #evaluator, inherited, #meets_conditions?, #node, #node_at_position, #parent, #replied?, #replied_at, #reply, #reply_to_parent, #root?, storage_type, #tree

Methods inherited from HiveDweller

#==, all, #attributes, #change_attribute, #changed?, create, #delete, each, fetch, ids, inherited, #initialize, many_to_one, #new?, new_from_storage, one_to_many, #reload!, #save, #set_attributes, set_columns, #storage, #storage_id, storage_id_for_key, storage_type, #to_hash

Constructor Details

This class inherits a constructor from Swarm::HiveDweller

Instance Method Details

#move_on_from(child) ⇒ Object



9
10
11
12
13
14
# File 'lib/swarm/expressions/sequence_expression.rb', line 9

def move_on_from(child)
  self.workitem = child.workitem
  kick_off_children([child.branch_position + 1])
rescue InvalidPositionError => e
  reply
end

#workObject



5
6
7
# File 'lib/swarm/expressions/sequence_expression.rb', line 5

def work
  kick_off_children([0])
end