Class: Ruote::Exp::RedoExpression

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

Overview

Undoes and the redoes (re-applies) an expression identified by a tag.

pdef = Ruote.process_definition do
  sequence :tag => 'kilroy' do
    alpha
    _redo :ref => 'kilroy', :unless => '${f:ok} == true'
  end
end

will redo at tag ‘kilroy’ if the field ‘ok’ is not set to true.

(redo is escaped as _redo not to conflict with the “redo” Ruby keyword)

Maybe this case is better served by a cursor/rewind combination

pdef = Ruote.process_definition do
  cursor do
    alpha
    rewind :unless => '${f:ok} == true'
  end
end

(There is a big difference though, a redo will restart with the workitem as it was when the workitem entered the tagged region, while the rewind keeps the workitem as is)

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?, #applied_workitem, #att, #att_text, #attribute, #attribute_text, #attributes, #await, #cancel, #cancel_flanks, #cfei_at, #child_id, #child_ids, #compile_atts, #compile_variables, #debug_id, #deflate, #do, do_action, #do_apply, #do_cancel, #do_fail, #do_pause, #do_persist, #do_reply, #do_reply_to_parent, #do_resume, #do_unpersist, dummy, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #is_concurrent?, #iterative_var_lookup, #launch_sub, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #pause_on_apply, #persist_or_raise, #reply_to_parent, #root, #root_id, #set_variable, #to_h, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables, #wfid

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



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ruote/exp/fe_redo.rb', line 59

def apply

  ref = attribute(:ref) || attribute_text
  tag = ref ? lookup_variable(ref) : nil

  if tag && Ruote.is_a_fei?(tag)

    @context.storage.put_msg(
      'cancel', 'fei' => tag, 're_apply' => { 'workitem' => 'applied' })

    reply_to_parent(h.applied_workitem) unless ancestor?(tag)

  else

    reply_to_parent(h.applied_workitem)
  end
end

#reply(workitem) ⇒ Object



77
78
79
80
# File 'lib/ruote/exp/fe_redo.rb', line 77

def reply(workitem)

  # never called
end