Class: Ruote::Exp::LetExpression

Inherits:
SequenceExpression show all
Defined in:
lib/ruote/exp/fe_let.rb

Overview

Behaves like a sequence, but the children have their own variable scope.

pdef = Ruote.process_definition do
  set 'v:var' => 'val'
  echo "out:${v:var}"
  let do
    set 'v:var' => 'val1'
    echo "in:${v:var}"
  end
  echo "out:${v:var}"
end

# => out:val, in:val1, out:val

as a ‘case’ statement

let do
  define 'published' do
    do_this
  end
  define 'reviewed' do
    do_that
  end
  subprocess '${case}'
end

Subprocesses ‘published’ and ‘reviewed’ are bound in a local scope, that gets discarded when the let exits.

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 SequenceExpression

#reply

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, #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



66
67
68
69
70
71
72
# File 'lib/ruote/exp/fe_let.rb', line 66

def apply

  h.variables = {}
    # the blank local scope

  reply(h.applied_workitem)
end