Class: Ruote::Exp::WaitExpression
- Inherits:
-
FlowExpression
- Object
- FlowExpression
- Ruote::Exp::WaitExpression
- Defined in:
- lib/ruote/exp/fe_wait.rb
Overview
Waits (sleeps) for a given period of time before resuming the flow.
sequence do
accounting :task => 'invoice'
wait '30d' # 30 days
accounting :task => 'check if customer paid'
end
‘_sleep’ is also OK
_sleep '7d10h' # 7 days and 10 hours
(the underscore prevents collision with Ruby’s sleep method)
:for and :until
‘wait’ accepts as well :
wait :for => '30d' # wait for 30 days
wait :until => '2011/12/10 12:00:00' # any parseable date/time format
Constant Summary
Constants inherited from FlowExpression
FlowExpression::COMMON_ATT_KEYS
Instance Attribute Summary
Attributes inherited from FlowExpression
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, #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
Methods included from WithH
Constructor Details
This class inherits a constructor from Ruote::Exp::FlowExpression
Instance Method Details
#apply ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ruote/exp/fe_wait.rb', line 54 def apply h.for = attribute(:for) || attribute_text h.until = attribute(:until) h.at = h.for h.at = h.until if h.at == '' return reply_to_parent(h.applied_workitem) unless h.at h.schedule_id = @context.storage.put_schedule( 'at', h.fei, h.at, 'action' => 'reply', 'fei' => h.fei, 'workitem' => h.applied_workitem) persist_or_raise end |