| Class | Ruote::Exp::LoseExpression |
| In: |
lib/ruote/exp/fe_lose.rb
|
| Parent: | FlowExpression |
Never replies to its parent expression. Simply applies its first child, if any, and just sits there.
When cancelled, cancels its child (if any).
In this example, the reminding sequence never replies to the concurrence. The concurrence is only over when "alfred" replies.
Ruote.process_definition do
concurrence :count => 1 do
alfred
lose do
sequence do
wait '2d'
send_reminder_to_alfred
wait '2h'
send_alarm_to_boss
end
end
end
end
Maybe shorter :
Ruote.process_definition do
concurrence :count => 1 do
alfred
sequence do
wait '2d'
send_reminder_to_alfred
wait '2h'
send_alarm_to_boss
lose
end
end
end
‘lose’ on its own acts like a dead-end.
Every expression understands the ‘lose’ attribute :
Ruote.process_definition do
concurrence :count => 1 do
alfred
sequence :lose => true do
wait '2d'
send_reminder_to_alfred
wait '2h'
send_alarm_to_boss
end
end
end
Probably produces definitions more compact than when using the ‘lose’ expression.
Losing multiple children:
lose do
alice :task => 'take out garbage'
bob :task => 'clean living room'
end
will trigger alice‘s and bob‘s tasks together. The lose expression will never reply, unless cancelled (in which case alice and bob task get cancelled as well).
forget : replies to parent expression immediately, is not cancellable (not reachable).
lose : never replies to the parent expression, is cancellable.
flank : immediately replies to the parent expression, is cancellable.