-
Notifications
You must be signed in to change notification settings - Fork 17
/
sequence.rb
71 lines (57 loc) · 1.44 KB
/
sequence.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# frozen_string_literal: true
class Flor::Pro::Sequence < Flor::Procedure
#
# Executes child expressions in sequence.
#
# ```
# sequence
# task 'alpha'
# task 'bravo' if f.amount > 2000
# task 'charly'
# ```
#
# Giving a string as attribute result to "sequence" lets it interpret
# that string as a tag name, as in:
# ```
# sequence 'phase one'
# alice 'gather customer requirements'
# bob 'establish offer'
# sequence 'phase two'
# alice 'present offer to customer'
# bob 'sign contract'
# ```
# It is equivalent to:
# ```
# sequence tag: 'phase one'
# alice 'gather customer requirements'
# bob 'establish offer'
# sequence tag: 'phase two'
# alice 'present offer to customer'
# bob 'sign contract'
# ```
# Learn more about [tags](../tags.md).
#
# Please note that it sets only 1 tag, and if there are already tags
# sets (`sequence tags: [ 'a' 'b' ] "this won't become a tag"`), it won't set
# further tags.
#
# ## see also
#
# Concurrence, loop
names %w[ sequence begin ]
def receive_att
ms = []
ms = enter_tag \
if @node['tags'].nil? && payload_ret.is_a?(String) && from_unkeyed_att?
ms + super
end
def cancel_when_closed
return cancel if node_status_flavour == 'on-error'
[]
end
protected
def enter_tag
@node['tags'] = tags = [ payload_ret ]
wrap('point' => 'entered', 'nid' => nid, 'tags' => tags)
end
end