Class: Ruote::Exp::SequenceExpression

Inherits:
FlowExpression show all
Defined in:
lib/ruote/exp/fe_sequence.rb

Overview

The plain ‘sequence’ expression.

sequence do
  participant 'alpha'
  participant 'bravo'
  participant 'charly'
end

Direct Known Subclasses

GivenExpression, LetExpression, ThatExpression

Constant Summary

Constants inherited from FlowExpression

FlowExpression::COMMON_ATT_KEYS

Instance Attribute Summary

Attributes inherited from FlowExpression

#context, #error, #h

Instance Method Summary collapse

Methods inherited from FlowExpression

#ancestor?, #att, #attribute, #attribute_text, #attributes, #cancel, #compile_atts, #compile_variables, do_action, #do_apply, #do_cancel, #do_fail, #do_pause, #do_persist, #do_reply, #do_resume, #do_unpersist, #expand_atts, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #iterative_var_lookup, #launch_sub, #lookup_on_error, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #persist_or_raise, #reply_to_parent, #set_variable, #to_h, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables

Methods included from WithMeta

#class_def, included

Methods included from WithH

included

Constructor Details

This class inherits a constructor from Ruote::Exp::FlowExpression

Instance Method Details

#applyObject



41
42
43
44
# File 'lib/ruote/exp/fe_sequence.rb', line 41

def apply

  reply(h.applied_workitem)
end

#reply(workitem) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ruote/exp/fe_sequence.rb', line 46

def reply(workitem)

  position = workitem['fei'] == h.fei ?
    0 : Ruote::FlowExpressionId.new(workitem['fei']).child_id + 1

  if position < tree_children.size
    apply_child(position, workitem)
  else
    reply_to_parent(workitem)
  end
end