Module: Simplerubysteps
- Defined in:
- lib/simplerubysteps/dsl.rb,
lib/simplerubysteps/tool.rb,
lib/simplerubysteps/model.rb,
lib/simplerubysteps/version.rb
Defined Under Namespace
Classes: Callback, Choice, ChoiceItem, State, StateMachine, Task, Tool
Constant Summary
collapse
- VERSION =
"0.0.8"
Instance Method Summary
collapse
Instance Method Details
#action(&action_block) ⇒ Object
31
32
33
|
# File 'lib/simplerubysteps/dsl.rb', line 31
def action(&action_block)
$tasks.last.action &action_block
end
|
#callback(name) ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/simplerubysteps/dsl.rb', line 21
def callback(name)
t = $sm.add Callback.new(name)
$tasks.last.next = t if $tasks.last
$tasks.push t
yield if block_given?
$tasks.pop
end
|
#choice(name) ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'lib/simplerubysteps/dsl.rb', line 58
def choice(name)
t = $sm.add Choice.new(name)
$tasks.last.next = t if $tasks.last
$tasks.push t
yield if block_given?
$tasks.pop
end
|
#default ⇒ Object
81
82
83
84
85
|
# File 'lib/simplerubysteps/dsl.rb', line 81
def default
$tasks.push $tasks.last
yield if block_given?
$tasks.pop
end
|
#default_transition_to(state) ⇒ Object
52
53
54
55
56
|
# File 'lib/simplerubysteps/dsl.rb', line 52
def default_transition_to(state)
choice = $tasks.last.implicit_choice
choice.default = state
end
|
#function_name ⇒ Object
4
5
6
7
|
# File 'lib/simplerubysteps/model.rb', line 4
def function_name
return "unknown" unless $FUNCTION_ARN =~ /.+\:function\:(.+)/
$1
end
|
#kind(k) ⇒ Object
7
8
9
|
# File 'lib/simplerubysteps/dsl.rb', line 7
def kind(k)
$sm.kind = k
end
|
#string_matches(var, match) ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/simplerubysteps/dsl.rb', line 68
def string_matches(var, match)
c = ChoiceItem.new({
:Variable => var,
:StringMatches => match,
})
$tasks.last.add c
$tasks.push c
yield if block_given?
$tasks.pop
end
|
#task(name) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/simplerubysteps/dsl.rb', line 11
def task(name)
t = $sm.add Task.new(name)
$tasks.last.next = t if $tasks.last
$tasks.push t
yield if block_given?
$tasks.pop
end
|
#transition(state) ⇒ Object
35
36
37
|
# File 'lib/simplerubysteps/dsl.rb', line 35
def transition(state)
$tasks.last.next = state
end
|
#transition_to(state, &condition_block) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/simplerubysteps/dsl.rb', line 39
def transition_to(state, &condition_block)
choice = $tasks.last.implicit_choice
c = ChoiceItem.new({
:Variable => "$.#{choice.name}_#{state}",
:StringMatches => "yes",
})
c.next = state
c.implicit_condition_block = condition_block
choice.add c
end
|