state_machine 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -11
- data/.travis.yml +49 -7
- data/Appraisals +255 -87
- data/CHANGELOG.md +30 -0
- data/README.md +142 -21
- data/Rakefile +1 -11
- data/examples/Gemfile +5 -0
- data/examples/Gemfile.lock +14 -0
- data/examples/auto_shop.rb +2 -0
- data/examples/car.rb +2 -0
- data/examples/doc/AutoShop.html +2856 -0
- data/examples/doc/AutoShop_state.png +0 -0
- data/examples/doc/Car.html +919 -0
- data/examples/doc/Car_state.png +0 -0
- data/examples/doc/TrafficLight.html +2230 -0
- data/examples/doc/TrafficLight_state.png +0 -0
- data/examples/doc/Vehicle.html +7921 -0
- data/examples/doc/Vehicle_state.png +0 -0
- data/examples/doc/_index.html +136 -0
- data/examples/doc/class_list.html +47 -0
- data/examples/doc/css/common.css +1 -0
- data/examples/doc/css/full_list.css +55 -0
- data/examples/doc/css/style.css +322 -0
- data/examples/doc/file_list.html +46 -0
- data/examples/doc/frames.html +13 -0
- data/examples/doc/index.html +136 -0
- data/examples/doc/js/app.js +205 -0
- data/examples/doc/js/full_list.js +173 -0
- data/examples/doc/js/jquery.js +16 -0
- data/examples/doc/method_list.html +734 -0
- data/examples/doc/top-level-namespace.html +105 -0
- data/examples/rails-rest/migration.rb +1 -5
- data/examples/rails-rest/view__form.html.erb +34 -0
- data/examples/rails-rest/view_edit.html.erb +2 -21
- data/examples/rails-rest/view_index.html.erb +6 -4
- data/examples/rails-rest/view_new.html.erb +2 -11
- data/examples/rails-rest/view_show.html.erb +5 -3
- data/examples/traffic_light.rb +2 -0
- data/examples/vehicle.rb +2 -0
- data/gemfiles/active_model-3.0.0.gemfile.lock +9 -6
- data/gemfiles/active_model-3.0.5.gemfile.lock +10 -7
- data/gemfiles/active_model-3.1.1.gemfile.lock +12 -10
- data/gemfiles/{active_model-3.2.0.gemfile → active_model-3.2.1.gemfile} +1 -1
- data/gemfiles/{graphviz-0.9.0.gemfile → active_model-3.2.12.gemfile} +1 -1
- data/gemfiles/active_model-3.2.12.gemfile.lock +36 -0
- data/gemfiles/{active_record-3.2.0.gemfile → active_model-3.2.13.rc1.gemfile} +1 -2
- data/gemfiles/active_model-3.2.13.rc1.gemfile.lock +36 -0
- data/gemfiles/active_model-4.0.0.gemfile +9 -0
- data/gemfiles/active_model-4.0.0.gemfile.lock +78 -0
- data/gemfiles/active_record-2.0.0.gemfile +2 -1
- data/gemfiles/active_record-2.0.0.gemfile.lock +15 -6
- data/gemfiles/active_record-2.0.5.gemfile +2 -1
- data/gemfiles/active_record-2.0.5.gemfile.lock +15 -6
- data/gemfiles/active_record-2.1.0.gemfile +2 -1
- data/gemfiles/active_record-2.1.0.gemfile.lock +15 -6
- data/gemfiles/active_record-2.1.2.gemfile +2 -1
- data/gemfiles/active_record-2.1.2.gemfile.lock +15 -6
- data/gemfiles/active_record-2.2.3.gemfile +2 -1
- data/gemfiles/active_record-2.2.3.gemfile.lock +15 -6
- data/gemfiles/active_record-2.3.12.gemfile +2 -1
- data/gemfiles/active_record-2.3.12.gemfile.lock +15 -6
- data/gemfiles/active_record-2.3.5.gemfile +9 -0
- data/gemfiles/active_record-2.3.5.gemfile.lock +39 -0
- data/gemfiles/active_record-3.0.0.gemfile +2 -1
- data/gemfiles/active_record-3.0.0.gemfile.lock +18 -11
- data/gemfiles/active_record-3.0.5.gemfile +2 -1
- data/gemfiles/active_record-3.0.5.gemfile.lock +19 -12
- data/gemfiles/active_record-3.1.1.gemfile +2 -1
- data/gemfiles/active_record-3.1.1.gemfile.lock +22 -16
- data/gemfiles/active_record-3.2.12.gemfile +9 -0
- data/gemfiles/active_record-3.2.12.gemfile.lock +51 -0
- data/gemfiles/active_record-3.2.13.rc1.gemfile +9 -0
- data/gemfiles/active_record-3.2.13.rc1.gemfile.lock +51 -0
- data/gemfiles/active_record-4.0.0.gemfile +11 -0
- data/gemfiles/active_record-4.0.0.gemfile.lock +83 -0
- data/gemfiles/data_mapper-0.10.2.gemfile +1 -0
- data/gemfiles/data_mapper-0.10.2.gemfile.lock +13 -9
- data/gemfiles/data_mapper-0.9.11.gemfile +1 -0
- data/gemfiles/data_mapper-0.9.11.gemfile.lock +31 -7
- data/gemfiles/data_mapper-0.9.4.gemfile.lock +25 -14
- data/gemfiles/data_mapper-0.9.7.gemfile +1 -0
- data/gemfiles/data_mapper-0.9.7.gemfile.lock +27 -15
- data/gemfiles/data_mapper-1.0.0.gemfile.lock +20 -17
- data/gemfiles/data_mapper-1.0.1.gemfile.lock +20 -17
- data/gemfiles/data_mapper-1.0.2.gemfile.lock +20 -17
- data/gemfiles/data_mapper-1.1.0.gemfile.lock +19 -16
- data/gemfiles/data_mapper-1.2.0.gemfile.lock +19 -16
- data/gemfiles/default.gemfile.lock +8 -5
- data/gemfiles/graphviz-0.9.17.gemfile +7 -0
- data/gemfiles/graphviz-0.9.17.gemfile.lock +29 -0
- data/gemfiles/graphviz-0.9.21.gemfile.lock +7 -4
- data/gemfiles/graphviz-1.0.0.gemfile.lock +7 -4
- data/gemfiles/graphviz-1.0.3.gemfile +7 -0
- data/gemfiles/graphviz-1.0.3.gemfile.lock +29 -0
- data/gemfiles/graphviz-1.0.8.gemfile +7 -0
- data/gemfiles/graphviz-1.0.8.gemfile.lock +29 -0
- data/gemfiles/mongo_mapper-0.10.0.gemfile +1 -0
- data/gemfiles/mongo_mapper-0.10.0.gemfile.lock +14 -11
- data/gemfiles/mongo_mapper-0.11.1.gemfile +7 -0
- data/gemfiles/mongo_mapper-0.11.1.gemfile.lock +44 -0
- data/gemfiles/mongo_mapper-0.11.2.gemfile +9 -0
- data/gemfiles/mongo_mapper-0.11.2.gemfile.lock +48 -0
- data/gemfiles/mongo_mapper-0.12.0.gemfile +9 -0
- data/gemfiles/mongo_mapper-0.12.0.gemfile.lock +48 -0
- data/gemfiles/mongo_mapper-0.5.5.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.5.8.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.6.0.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.6.10.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.7.0.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.7.5.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.8.0.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.8.3.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.8.4.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.8.6.gemfile.lock +7 -4
- data/gemfiles/mongo_mapper-0.9.0.gemfile.lock +7 -4
- data/gemfiles/mongoid-2.0.0.gemfile +2 -0
- data/gemfiles/mongoid-2.0.0.gemfile.lock +22 -18
- data/gemfiles/mongoid-2.1.4.gemfile +2 -0
- data/gemfiles/mongoid-2.1.4.gemfile.lock +21 -17
- data/gemfiles/mongoid-2.2.4.gemfile +2 -0
- data/gemfiles/mongoid-2.2.4.gemfile.lock +21 -17
- data/gemfiles/mongoid-2.3.3.gemfile +2 -0
- data/gemfiles/mongoid-2.3.3.gemfile.lock +21 -17
- data/gemfiles/mongoid-2.4.0.gemfile +9 -0
- data/gemfiles/mongoid-2.4.0.gemfile.lock +47 -0
- data/gemfiles/mongoid-2.4.10.gemfile +9 -0
- data/gemfiles/mongoid-2.4.10.gemfile.lock +47 -0
- data/gemfiles/mongoid-2.5.2.gemfile +9 -0
- data/gemfiles/mongoid-2.5.2.gemfile.lock +47 -0
- data/gemfiles/mongoid-2.6.0.gemfile +9 -0
- data/gemfiles/mongoid-2.6.0.gemfile.lock +47 -0
- data/gemfiles/mongoid-3.0.0.gemfile +8 -0
- data/gemfiles/mongoid-3.0.0.gemfile.lock +45 -0
- data/gemfiles/mongoid-3.0.22.gemfile +8 -0
- data/gemfiles/mongoid-3.0.22.gemfile.lock +45 -0
- data/gemfiles/mongoid-3.1.0.gemfile +8 -0
- data/gemfiles/mongoid-3.1.0.gemfile.lock +45 -0
- data/gemfiles/sequel-2.11.0.gemfile +2 -1
- data/gemfiles/sequel-2.11.0.gemfile.lock +11 -6
- data/gemfiles/sequel-2.12.0.gemfile +2 -1
- data/gemfiles/sequel-2.12.0.gemfile.lock +11 -6
- data/gemfiles/sequel-2.8.0.gemfile +2 -1
- data/gemfiles/sequel-2.8.0.gemfile.lock +11 -6
- data/gemfiles/sequel-3.0.0.gemfile +2 -1
- data/gemfiles/sequel-3.0.0.gemfile.lock +11 -6
- data/gemfiles/sequel-3.10.0.gemfile +9 -0
- data/gemfiles/sequel-3.10.0.gemfile.lock +33 -0
- data/gemfiles/sequel-3.13.0.gemfile +2 -1
- data/gemfiles/sequel-3.13.0.gemfile.lock +11 -6
- data/gemfiles/sequel-3.14.0.gemfile +2 -1
- data/gemfiles/sequel-3.14.0.gemfile.lock +11 -6
- data/gemfiles/sequel-3.23.0.gemfile +2 -1
- data/gemfiles/sequel-3.23.0.gemfile.lock +11 -6
- data/gemfiles/sequel-3.24.0.gemfile +2 -1
- data/gemfiles/sequel-3.24.0.gemfile.lock +11 -6
- data/gemfiles/sequel-3.29.0.gemfile +2 -1
- data/gemfiles/sequel-3.29.0.gemfile.lock +11 -6
- data/gemfiles/sequel-3.34.0.gemfile +9 -0
- data/gemfiles/sequel-3.34.0.gemfile.lock +33 -0
- data/gemfiles/sequel-3.35.0.gemfile +9 -0
- data/gemfiles/sequel-3.35.0.gemfile.lock +33 -0
- data/gemfiles/sequel-3.4.0.gemfile +9 -0
- data/gemfiles/sequel-3.4.0.gemfile.lock +33 -0
- data/gemfiles/sequel-3.44.0.gemfile +9 -0
- data/gemfiles/sequel-3.44.0.gemfile.lock +33 -0
- data/lib/state_machine.rb +6 -0
- data/lib/state_machine/branch.rb +9 -8
- data/lib/state_machine/callback.rb +2 -2
- data/lib/state_machine/core.rb +10 -0
- data/lib/state_machine/core_ext.rb +1 -0
- data/lib/state_machine/eval_helpers.rb +5 -3
- data/lib/state_machine/event.rb +17 -6
- data/lib/state_machine/graph.rb +92 -0
- data/lib/state_machine/integrations.rb +13 -1
- data/lib/state_machine/integrations/active_model.rb +14 -20
- data/lib/state_machine/integrations/active_model/observer.rb +3 -3
- data/lib/state_machine/integrations/active_model/observer_update.rb +42 -0
- data/lib/state_machine/integrations/active_record.rb +52 -25
- data/lib/state_machine/integrations/active_record/locale.rb +1 -1
- data/lib/state_machine/integrations/active_record/versions.rb +1 -17
- data/lib/state_machine/integrations/base.rb +15 -6
- data/lib/state_machine/integrations/data_mapper.rb +98 -35
- data/lib/state_machine/integrations/data_mapper/versions.rb +46 -8
- data/lib/state_machine/integrations/mongo_mapper.rb +39 -12
- data/lib/state_machine/integrations/mongo_mapper/locale.rb +1 -1
- data/lib/state_machine/integrations/mongo_mapper/versions.rb +3 -20
- data/lib/state_machine/integrations/mongoid.rb +52 -14
- data/lib/state_machine/integrations/mongoid/locale.rb +1 -1
- data/lib/state_machine/integrations/mongoid/versions.rb +52 -26
- data/lib/state_machine/integrations/sequel.rb +82 -33
- data/lib/state_machine/integrations/sequel/versions.rb +19 -44
- data/lib/state_machine/machine.rb +99 -59
- data/lib/state_machine/machine_collection.rb +1 -2
- data/lib/state_machine/macro_methods.rb +29 -0
- data/lib/state_machine/node_collection.rb +1 -1
- data/lib/state_machine/state.rb +18 -10
- data/lib/state_machine/state_context.rb +2 -2
- data/lib/state_machine/transition.rb +8 -1
- data/lib/state_machine/transition_collection.rb +2 -1
- data/lib/state_machine/version.rb +1 -1
- data/lib/state_machine/yard.rb +8 -0
- data/lib/state_machine/yard/handlers.rb +12 -0
- data/lib/state_machine/yard/handlers/base.rb +32 -0
- data/lib/state_machine/yard/handlers/event.rb +25 -0
- data/lib/state_machine/yard/handlers/machine.rb +344 -0
- data/lib/state_machine/yard/handlers/state.rb +25 -0
- data/lib/state_machine/yard/handlers/transition.rb +47 -0
- data/lib/state_machine/yard/templates.rb +3 -0
- data/lib/state_machine/yard/templates/default/class/html/setup.rb +30 -0
- data/lib/state_machine/yard/templates/default/class/html/state_machines.erb +12 -0
- data/lib/tasks/state_machine.rb +2 -1
- data/lib/yard-state_machine.rb +2 -0
- data/state_machine.gemspec +4 -3
- data/test/files/switch.rb +4 -0
- data/test/test_helper.rb +5 -0
- data/test/unit/branch_test.rb +117 -36
- data/test/unit/callback_test.rb +5 -2
- data/test/unit/eval_helpers_test.rb +49 -1
- data/test/unit/event_collection_test.rb +3 -1
- data/test/unit/event_test.rb +182 -12
- data/test/unit/graph_test.rb +98 -0
- data/test/unit/integrations/active_model_test.rb +82 -12
- data/test/unit/integrations/active_record_test.rb +393 -37
- data/test/unit/integrations/base_test.rb +7 -2
- data/test/unit/integrations/data_mapper_test.rb +326 -72
- data/test/unit/integrations/mongo_mapper_test.rb +338 -44
- data/test/unit/integrations/mongoid_test.rb +606 -98
- data/test/unit/integrations/sequel_test.rb +429 -102
- data/test/unit/integrations_test.rb +28 -6
- data/test/unit/machine_collection_test.rb +6 -2
- data/test/unit/machine_test.rb +134 -82
- data/test/unit/node_collection_test.rb +2 -2
- data/test/unit/path_test.rb +1 -1
- data/test/unit/state_test.rb +65 -21
- data/test/unit/transition_collection_test.rb +43 -23
- data/test/unit/transition_test.rb +8 -2
- metadata +303 -221
- data/gemfiles/active_model-3.2.0.gemfile.lock +0 -32
- data/gemfiles/active_record-3.2.0.gemfile.lock +0 -43
- data/gemfiles/graphviz-0.9.0.gemfile.lock +0 -26
Binary file
|
@@ -0,0 +1,919 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Car
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html">Index (C)</a> »
|
37
|
+
|
38
|
+
|
39
|
+
<span class="title">Car</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Class: Car
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName"><span class='object_link'><a href="Vehicle.html" title="Vehicle (class)">Vehicle</a></span></span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next"><span class='object_link'><a href="Vehicle.html" title="Vehicle (class)">Vehicle</a></span></li>
|
75
|
+
|
76
|
+
<li class="next">Car</li>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
<a href="#" class="inheritanceTree">show all</a>
|
80
|
+
|
81
|
+
</dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2 last">Defined in:</dt>
|
92
|
+
<dd class="r2 last">car.rb</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
<div class="clear"></div>
|
96
|
+
|
97
|
+
<h2>State Machines</h2>
|
98
|
+
|
99
|
+
This class contains 1 state machine(s).
|
100
|
+
|
101
|
+
|
102
|
+
<h3>state</h3>
|
103
|
+
<p></p>
|
104
|
+
|
105
|
+
|
106
|
+
<img alt="State machine diagram for state" src="Car_state.png" />
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<h2>Instance Attribute Summary</h2>
|
116
|
+
|
117
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Vehicle.html" title="Vehicle (class)">Vehicle</a></span></h3>
|
118
|
+
<p class="inherited"><span class='object_link'><a href="Vehicle.html#state-instance_method" title="Vehicle#state (method)">#state</a></span></p>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<h2>
|
123
|
+
Instance Method Summary
|
124
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
125
|
+
</h2>
|
126
|
+
|
127
|
+
<ul class="summary">
|
128
|
+
|
129
|
+
<li class="public ">
|
130
|
+
<span class="summary_signature">
|
131
|
+
|
132
|
+
<a href="#backing_up%3F-instance_method" title="#backing_up? (instance method)">- (Boolean) <strong>backing_up?</strong> </a>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
</span>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'><p>
|
146
|
+
Checks whether :backing_up is the current state.
|
147
|
+
</p>
|
148
|
+
</div></span>
|
149
|
+
|
150
|
+
</li>
|
151
|
+
|
152
|
+
|
153
|
+
<li class="public ">
|
154
|
+
<span class="summary_signature">
|
155
|
+
|
156
|
+
<a href="#can_reverse%3F-instance_method" title="#can_reverse? (instance method)">- (Boolean) <strong>can_reverse?</strong>(requirements = {}) </a>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
</span>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<span class="summary_desc"><div class='inline'><p>
|
170
|
+
Checks whether :reverse can be fired.
|
171
|
+
</p>
|
172
|
+
</div></span>
|
173
|
+
|
174
|
+
</li>
|
175
|
+
|
176
|
+
|
177
|
+
<li class="public ">
|
178
|
+
<span class="summary_signature">
|
179
|
+
|
180
|
+
<a href="#reverse-instance_method" title="#reverse (instance method)">- (Boolean) <strong>reverse</strong>(*args) </a>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
</span>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<span class="summary_desc"><div class='inline'><p>
|
194
|
+
Fires the :reverse event.
|
195
|
+
</p>
|
196
|
+
</div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#reverse%21-instance_method" title="#reverse! (instance method)">- (Boolean) <strong>reverse!</strong>(*args) </a>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<span class="summary_desc"><div class='inline'><p>
|
218
|
+
Fires the :reverse event, raising an exception if it fails.
|
219
|
+
</p>
|
220
|
+
</div></span>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
<li class="public ">
|
226
|
+
<span class="summary_signature">
|
227
|
+
|
228
|
+
<a href="#reverse_transition-instance_method" title="#reverse_transition (instance method)">- (StateMachine::Transition) <strong>reverse_transition</strong>(requirements = {}) </a>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<span class="summary_desc"><div class='inline'><p>
|
242
|
+
Gets the next transition that would be performed if :reverse were to be
|
243
|
+
fired.
|
244
|
+
</p>
|
245
|
+
</div></span>
|
246
|
+
|
247
|
+
</li>
|
248
|
+
|
249
|
+
|
250
|
+
</ul>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Vehicle.html" title="Vehicle (class)">Vehicle</a></span></h3>
|
262
|
+
<p class="inherited"><span class='object_link'><a href="Vehicle.html#can_crash%3F-instance_method" title="Vehicle#can_crash? (method)">#can_crash?</a></span>, <span class='object_link'><a href="Vehicle.html#can_idle%3F-instance_method" title="Vehicle#can_idle? (method)">#can_idle?</a></span>, <span class='object_link'><a href="Vehicle.html#can_ignite%3F-instance_method" title="Vehicle#can_ignite? (method)">#can_ignite?</a></span>, <span class='object_link'><a href="Vehicle.html#can_park%3F-instance_method" title="Vehicle#can_park? (method)">#can_park?</a></span>, <span class='object_link'><a href="Vehicle.html#can_repair%3F-instance_method" title="Vehicle#can_repair? (method)">#can_repair?</a></span>, <span class='object_link'><a href="Vehicle.html#can_shift_down%3F-instance_method" title="Vehicle#can_shift_down? (method)">#can_shift_down?</a></span>, <span class='object_link'><a href="Vehicle.html#can_shift_up%3F-instance_method" title="Vehicle#can_shift_up? (method)">#can_shift_up?</a></span>, <span class='object_link'><a href="Vehicle.html#crash-instance_method" title="Vehicle#crash (method)">#crash</a></span>, <span class='object_link'><a href="Vehicle.html#crash%21-instance_method" title="Vehicle#crash! (method)">#crash!</a></span>, <span class='object_link'><a href="Vehicle.html#crash_transition-instance_method" title="Vehicle#crash_transition (method)">#crash_transition</a></span>, <span class='object_link'><a href="Vehicle.html#fire_state_event-instance_method" title="Vehicle#fire_state_event (method)">#fire_state_event</a></span>, <span class='object_link'><a href="Vehicle.html#first_gear%3F-instance_method" title="Vehicle#first_gear? (method)">#first_gear?</a></span>, <span class='object_link'><a href="Vehicle.html#human_state_event_name-class_method" title="Vehicle.human_state_event_name (method)">human_state_event_name</a></span>, <span class='object_link'><a href="Vehicle.html#human_state_name-class_method" title="Vehicle.human_state_name (method)">human_state_name</a></span>, <span class='object_link'><a href="Vehicle.html#human_state_name-instance_method" title="Vehicle#human_state_name (method)">#human_state_name</a></span>, <span class='object_link'><a href="Vehicle.html#idle-instance_method" title="Vehicle#idle (method)">#idle</a></span>, <span class='object_link'><a href="Vehicle.html#idle%21-instance_method" title="Vehicle#idle! (method)">#idle!</a></span>, <span class='object_link'><a href="Vehicle.html#idle_transition-instance_method" title="Vehicle#idle_transition (method)">#idle_transition</a></span>, <span class='object_link'><a href="Vehicle.html#idling%3F-instance_method" title="Vehicle#idling? (method)">#idling?</a></span>, <span class='object_link'><a href="Vehicle.html#ignite-instance_method" title="Vehicle#ignite (method)">#ignite</a></span>, <span class='object_link'><a href="Vehicle.html#ignite%21-instance_method" title="Vehicle#ignite! (method)">#ignite!</a></span>, <span class='object_link'><a href="Vehicle.html#ignite_transition-instance_method" title="Vehicle#ignite_transition (method)">#ignite_transition</a></span>, <span class='object_link'><a href="Vehicle.html#park-instance_method" title="Vehicle#park (method)">#park</a></span>, <span class='object_link'><a href="Vehicle.html#park%21-instance_method" title="Vehicle#park! (method)">#park!</a></span>, <span class='object_link'><a href="Vehicle.html#park_transition-instance_method" title="Vehicle#park_transition (method)">#park_transition</a></span>, <span class='object_link'><a href="Vehicle.html#parked%3F-instance_method" title="Vehicle#parked? (method)">#parked?</a></span>, <span class='object_link'><a href="Vehicle.html#repair-instance_method" title="Vehicle#repair (method)">#repair</a></span>, <span class='object_link'><a href="Vehicle.html#repair%21-instance_method" title="Vehicle#repair! (method)">#repair!</a></span>, <span class='object_link'><a href="Vehicle.html#repair_transition-instance_method" title="Vehicle#repair_transition (method)">#repair_transition</a></span>, <span class='object_link'><a href="Vehicle.html#second_gear%3F-instance_method" title="Vehicle#second_gear? (method)">#second_gear?</a></span>, <span class='object_link'><a href="Vehicle.html#shift_down-instance_method" title="Vehicle#shift_down (method)">#shift_down</a></span>, <span class='object_link'><a href="Vehicle.html#shift_down%21-instance_method" title="Vehicle#shift_down! (method)">#shift_down!</a></span>, <span class='object_link'><a href="Vehicle.html#shift_down_transition-instance_method" title="Vehicle#shift_down_transition (method)">#shift_down_transition</a></span>, <span class='object_link'><a href="Vehicle.html#shift_up-instance_method" title="Vehicle#shift_up (method)">#shift_up</a></span>, <span class='object_link'><a href="Vehicle.html#shift_up%21-instance_method" title="Vehicle#shift_up! (method)">#shift_up!</a></span>, <span class='object_link'><a href="Vehicle.html#shift_up_transition-instance_method" title="Vehicle#shift_up_transition (method)">#shift_up_transition</a></span>, <span class='object_link'><a href="Vehicle.html#stalled%3F-instance_method" title="Vehicle#stalled? (method)">#stalled?</a></span>, <span class='object_link'><a href="Vehicle.html#state%3F-instance_method" title="Vehicle#state? (method)">#state?</a></span>, <span class='object_link'><a href="Vehicle.html#state_events-instance_method" title="Vehicle#state_events (method)">#state_events</a></span>, <span class='object_link'><a href="Vehicle.html#state_name-instance_method" title="Vehicle#state_name (method)">#state_name</a></span>, <span class='object_link'><a href="Vehicle.html#state_paths-instance_method" title="Vehicle#state_paths (method)">#state_paths</a></span>, <span class='object_link'><a href="Vehicle.html#state_transitions-instance_method" title="Vehicle#state_transitions (method)">#state_transitions</a></span>, <span class='object_link'><a href="Vehicle.html#third_gear%3F-instance_method" title="Vehicle#third_gear? (method)">#third_gear?</a></span></p>
|
263
|
+
|
264
|
+
|
265
|
+
<div id="instance_method_details" class="method_details_list">
|
266
|
+
<h2>Instance Method Details</h2>
|
267
|
+
|
268
|
+
|
269
|
+
<div class="method_details first">
|
270
|
+
<p class="signature first" id="backing_up?-instance_method">
|
271
|
+
|
272
|
+
- (<tt>Boolean</tt>) <strong>backing_up?</strong>
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
</p><div class="docstring">
|
277
|
+
<div class="discussion">
|
278
|
+
<p>
|
279
|
+
Checks whether :backing_up is the current state.
|
280
|
+
</p>
|
281
|
+
|
282
|
+
|
283
|
+
</div>
|
284
|
+
</div>
|
285
|
+
<div class="tags">
|
286
|
+
|
287
|
+
<h3>Returns:</h3>
|
288
|
+
<ul class="return">
|
289
|
+
|
290
|
+
<li>
|
291
|
+
|
292
|
+
|
293
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
—
|
298
|
+
<div class='inline'><p>
|
299
|
+
<tt>true</tt> if this is the current state, otherwise <tt>false</tt>
|
300
|
+
</p>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
</li>
|
304
|
+
|
305
|
+
</ul>
|
306
|
+
|
307
|
+
</div><table class="source_code">
|
308
|
+
<tr>
|
309
|
+
<td>
|
310
|
+
<pre class="lines">
|
311
|
+
|
312
|
+
|
313
|
+
4
|
314
|
+
5
|
315
|
+
6
|
316
|
+
7
|
317
|
+
8
|
318
|
+
9
|
319
|
+
10
|
320
|
+
11
|
321
|
+
12
|
322
|
+
13
|
323
|
+
14
|
324
|
+
15
|
325
|
+
16
|
326
|
+
17
|
327
|
+
18
|
328
|
+
19
|
329
|
+
20</pre>
|
330
|
+
</td>
|
331
|
+
<td>
|
332
|
+
<pre class="code"><span class="info file"># File 'car.rb', line 4</span>
|
333
|
+
|
334
|
+
<span class='id identifier rubyid_state_machine'>state_machine</span> <span class='kw'>do</span>
|
335
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:reverse</span> <span class='kw'>do</span>
|
336
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='lbracket'>[</span><span class='symbol'>:parked</span><span class='comma'>,</span> <span class='symbol'>:idling</span><span class='comma'>,</span> <span class='symbol'>:first_gear</span><span class='rbracket'>]</span> <span class='op'>=></span> <span class='symbol'>:backing_up</span>
|
337
|
+
<span class='kw'>end</span>
|
338
|
+
|
339
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:park</span> <span class='kw'>do</span>
|
340
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:parked</span>
|
341
|
+
<span class='kw'>end</span>
|
342
|
+
|
343
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:idle</span> <span class='kw'>do</span>
|
344
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:idling</span>
|
345
|
+
<span class='kw'>end</span>
|
346
|
+
|
347
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:shift_up</span> <span class='kw'>do</span>
|
348
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:first_gear</span>
|
349
|
+
<span class='kw'>end</span>
|
350
|
+
<span class='kw'>end</span></pre>
|
351
|
+
</td>
|
352
|
+
</tr>
|
353
|
+
</table>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<div class="method_details ">
|
357
|
+
<p class="signature " id="can_reverse?-instance_method">
|
358
|
+
|
359
|
+
- (<tt>Boolean</tt>) <strong>can_reverse?</strong>(requirements = {})
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
</p><div class="docstring">
|
364
|
+
<div class="discussion">
|
365
|
+
<p>
|
366
|
+
Checks whether :reverse can be fired.
|
367
|
+
</p>
|
368
|
+
|
369
|
+
|
370
|
+
</div>
|
371
|
+
</div>
|
372
|
+
<div class="tags">
|
373
|
+
<h3>Parameters:</h3>
|
374
|
+
<ul class="param">
|
375
|
+
|
376
|
+
<li>
|
377
|
+
|
378
|
+
<span class='name'>requirements</span>
|
379
|
+
|
380
|
+
|
381
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
382
|
+
|
383
|
+
|
384
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
385
|
+
|
386
|
+
|
387
|
+
—
|
388
|
+
<div class='inline'><p>
|
389
|
+
The transition requirements to test against
|
390
|
+
</p>
|
391
|
+
</div>
|
392
|
+
|
393
|
+
</li>
|
394
|
+
|
395
|
+
</ul>
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
<h3>Options Hash (<tt>requirements</tt>):</h3>
|
401
|
+
<ul class="option">
|
402
|
+
|
403
|
+
<li>
|
404
|
+
<span class="name">:from</span>
|
405
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
406
|
+
<span class="default">
|
407
|
+
|
408
|
+
— default:
|
409
|
+
<tt>the current state</tt>
|
410
|
+
|
411
|
+
</span>
|
412
|
+
— <div class='inline'><p>
|
413
|
+
One or more initial states
|
414
|
+
</p>
|
415
|
+
</div>
|
416
|
+
</li>
|
417
|
+
|
418
|
+
<li>
|
419
|
+
<span class="name">:to</span>
|
420
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
421
|
+
<span class="default">
|
422
|
+
|
423
|
+
</span>
|
424
|
+
— <div class='inline'><p>
|
425
|
+
One or more target states
|
426
|
+
</p>
|
427
|
+
</div>
|
428
|
+
</li>
|
429
|
+
|
430
|
+
<li>
|
431
|
+
<span class="name">:guard</span>
|
432
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
433
|
+
<span class="default">
|
434
|
+
|
435
|
+
</span>
|
436
|
+
— <div class='inline'><p>
|
437
|
+
Whether to guard transitions with conditionals
|
438
|
+
</p>
|
439
|
+
</div>
|
440
|
+
</li>
|
441
|
+
|
442
|
+
</ul>
|
443
|
+
|
444
|
+
|
445
|
+
<h3>Returns:</h3>
|
446
|
+
<ul class="return">
|
447
|
+
|
448
|
+
<li>
|
449
|
+
|
450
|
+
|
451
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
—
|
456
|
+
<div class='inline'><p>
|
457
|
+
<tt>true</tt> if :reverse can be fired, otherwise <tt>false</tt>
|
458
|
+
</p>
|
459
|
+
</div>
|
460
|
+
|
461
|
+
</li>
|
462
|
+
|
463
|
+
</ul>
|
464
|
+
|
465
|
+
</div><table class="source_code">
|
466
|
+
<tr>
|
467
|
+
<td>
|
468
|
+
<pre class="lines">
|
469
|
+
|
470
|
+
|
471
|
+
4
|
472
|
+
5
|
473
|
+
6
|
474
|
+
7
|
475
|
+
8
|
476
|
+
9
|
477
|
+
10
|
478
|
+
11
|
479
|
+
12
|
480
|
+
13
|
481
|
+
14
|
482
|
+
15
|
483
|
+
16
|
484
|
+
17
|
485
|
+
18
|
486
|
+
19
|
487
|
+
20</pre>
|
488
|
+
</td>
|
489
|
+
<td>
|
490
|
+
<pre class="code"><span class="info file"># File 'car.rb', line 4</span>
|
491
|
+
|
492
|
+
<span class='id identifier rubyid_state_machine'>state_machine</span> <span class='kw'>do</span>
|
493
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:reverse</span> <span class='kw'>do</span>
|
494
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='lbracket'>[</span><span class='symbol'>:parked</span><span class='comma'>,</span> <span class='symbol'>:idling</span><span class='comma'>,</span> <span class='symbol'>:first_gear</span><span class='rbracket'>]</span> <span class='op'>=></span> <span class='symbol'>:backing_up</span>
|
495
|
+
<span class='kw'>end</span>
|
496
|
+
|
497
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:park</span> <span class='kw'>do</span>
|
498
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:parked</span>
|
499
|
+
<span class='kw'>end</span>
|
500
|
+
|
501
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:idle</span> <span class='kw'>do</span>
|
502
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:idling</span>
|
503
|
+
<span class='kw'>end</span>
|
504
|
+
|
505
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:shift_up</span> <span class='kw'>do</span>
|
506
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:first_gear</span>
|
507
|
+
<span class='kw'>end</span>
|
508
|
+
<span class='kw'>end</span></pre>
|
509
|
+
</td>
|
510
|
+
</tr>
|
511
|
+
</table>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
<div class="method_details ">
|
515
|
+
<p class="signature " id="reverse-instance_method">
|
516
|
+
|
517
|
+
- (<tt>Boolean</tt>) <strong>reverse</strong>(*args)
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
</p><div class="docstring">
|
522
|
+
<div class="discussion">
|
523
|
+
<p>
|
524
|
+
Fires the :reverse event.
|
525
|
+
</p>
|
526
|
+
|
527
|
+
|
528
|
+
</div>
|
529
|
+
</div>
|
530
|
+
<div class="tags">
|
531
|
+
<h3>Parameters:</h3>
|
532
|
+
<ul class="param">
|
533
|
+
|
534
|
+
<li>
|
535
|
+
|
536
|
+
<span class='name'>args</span>
|
537
|
+
|
538
|
+
|
539
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
—
|
544
|
+
<div class='inline'><p>
|
545
|
+
Optional arguments to include in transition callbacks
|
546
|
+
</p>
|
547
|
+
</div>
|
548
|
+
|
549
|
+
</li>
|
550
|
+
|
551
|
+
</ul>
|
552
|
+
|
553
|
+
<h3>Returns:</h3>
|
554
|
+
<ul class="return">
|
555
|
+
|
556
|
+
<li>
|
557
|
+
|
558
|
+
|
559
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
—
|
564
|
+
<div class='inline'><p>
|
565
|
+
<tt>true</tt> if the transition succeeds, otherwise <tt>false</tt>
|
566
|
+
</p>
|
567
|
+
</div>
|
568
|
+
|
569
|
+
</li>
|
570
|
+
|
571
|
+
</ul>
|
572
|
+
|
573
|
+
</div><table class="source_code">
|
574
|
+
<tr>
|
575
|
+
<td>
|
576
|
+
<pre class="lines">
|
577
|
+
|
578
|
+
|
579
|
+
4
|
580
|
+
5
|
581
|
+
6
|
582
|
+
7
|
583
|
+
8
|
584
|
+
9
|
585
|
+
10
|
586
|
+
11
|
587
|
+
12
|
588
|
+
13
|
589
|
+
14
|
590
|
+
15
|
591
|
+
16
|
592
|
+
17
|
593
|
+
18
|
594
|
+
19
|
595
|
+
20</pre>
|
596
|
+
</td>
|
597
|
+
<td>
|
598
|
+
<pre class="code"><span class="info file"># File 'car.rb', line 4</span>
|
599
|
+
|
600
|
+
<span class='id identifier rubyid_state_machine'>state_machine</span> <span class='kw'>do</span>
|
601
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:reverse</span> <span class='kw'>do</span>
|
602
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='lbracket'>[</span><span class='symbol'>:parked</span><span class='comma'>,</span> <span class='symbol'>:idling</span><span class='comma'>,</span> <span class='symbol'>:first_gear</span><span class='rbracket'>]</span> <span class='op'>=></span> <span class='symbol'>:backing_up</span>
|
603
|
+
<span class='kw'>end</span>
|
604
|
+
|
605
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:park</span> <span class='kw'>do</span>
|
606
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:parked</span>
|
607
|
+
<span class='kw'>end</span>
|
608
|
+
|
609
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:idle</span> <span class='kw'>do</span>
|
610
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:idling</span>
|
611
|
+
<span class='kw'>end</span>
|
612
|
+
|
613
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:shift_up</span> <span class='kw'>do</span>
|
614
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:first_gear</span>
|
615
|
+
<span class='kw'>end</span>
|
616
|
+
<span class='kw'>end</span></pre>
|
617
|
+
</td>
|
618
|
+
</tr>
|
619
|
+
</table>
|
620
|
+
</div>
|
621
|
+
|
622
|
+
<div class="method_details ">
|
623
|
+
<p class="signature " id="reverse!-instance_method">
|
624
|
+
|
625
|
+
- (<tt>Boolean</tt>) <strong>reverse!</strong>(*args)
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
</p><div class="docstring">
|
630
|
+
<div class="discussion">
|
631
|
+
<p>
|
632
|
+
Fires the :reverse event, raising an exception if it fails.
|
633
|
+
</p>
|
634
|
+
|
635
|
+
|
636
|
+
</div>
|
637
|
+
</div>
|
638
|
+
<div class="tags">
|
639
|
+
<h3>Parameters:</h3>
|
640
|
+
<ul class="param">
|
641
|
+
|
642
|
+
<li>
|
643
|
+
|
644
|
+
<span class='name'>args</span>
|
645
|
+
|
646
|
+
|
647
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
648
|
+
|
649
|
+
|
650
|
+
|
651
|
+
—
|
652
|
+
<div class='inline'><p>
|
653
|
+
Optional arguments to include in transition callbacks
|
654
|
+
</p>
|
655
|
+
</div>
|
656
|
+
|
657
|
+
</li>
|
658
|
+
|
659
|
+
</ul>
|
660
|
+
|
661
|
+
<h3>Returns:</h3>
|
662
|
+
<ul class="return">
|
663
|
+
|
664
|
+
<li>
|
665
|
+
|
666
|
+
|
667
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
—
|
672
|
+
<div class='inline'><p>
|
673
|
+
<tt>true</tt> if the transition succeeds
|
674
|
+
</p>
|
675
|
+
</div>
|
676
|
+
|
677
|
+
</li>
|
678
|
+
|
679
|
+
</ul>
|
680
|
+
<h3>Raises:</h3>
|
681
|
+
<ul class="raise">
|
682
|
+
|
683
|
+
<li>
|
684
|
+
|
685
|
+
|
686
|
+
<span class='type'>(<tt>StateMachine::InvalidTransition</tt>)</span>
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
—
|
691
|
+
<div class='inline'><p>
|
692
|
+
If the transition fails
|
693
|
+
</p>
|
694
|
+
</div>
|
695
|
+
|
696
|
+
</li>
|
697
|
+
|
698
|
+
</ul>
|
699
|
+
|
700
|
+
</div><table class="source_code">
|
701
|
+
<tr>
|
702
|
+
<td>
|
703
|
+
<pre class="lines">
|
704
|
+
|
705
|
+
|
706
|
+
4
|
707
|
+
5
|
708
|
+
6
|
709
|
+
7
|
710
|
+
8
|
711
|
+
9
|
712
|
+
10
|
713
|
+
11
|
714
|
+
12
|
715
|
+
13
|
716
|
+
14
|
717
|
+
15
|
718
|
+
16
|
719
|
+
17
|
720
|
+
18
|
721
|
+
19
|
722
|
+
20</pre>
|
723
|
+
</td>
|
724
|
+
<td>
|
725
|
+
<pre class="code"><span class="info file"># File 'car.rb', line 4</span>
|
726
|
+
|
727
|
+
<span class='id identifier rubyid_state_machine'>state_machine</span> <span class='kw'>do</span>
|
728
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:reverse</span> <span class='kw'>do</span>
|
729
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='lbracket'>[</span><span class='symbol'>:parked</span><span class='comma'>,</span> <span class='symbol'>:idling</span><span class='comma'>,</span> <span class='symbol'>:first_gear</span><span class='rbracket'>]</span> <span class='op'>=></span> <span class='symbol'>:backing_up</span>
|
730
|
+
<span class='kw'>end</span>
|
731
|
+
|
732
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:park</span> <span class='kw'>do</span>
|
733
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:parked</span>
|
734
|
+
<span class='kw'>end</span>
|
735
|
+
|
736
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:idle</span> <span class='kw'>do</span>
|
737
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:idling</span>
|
738
|
+
<span class='kw'>end</span>
|
739
|
+
|
740
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:shift_up</span> <span class='kw'>do</span>
|
741
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:first_gear</span>
|
742
|
+
<span class='kw'>end</span>
|
743
|
+
<span class='kw'>end</span></pre>
|
744
|
+
</td>
|
745
|
+
</tr>
|
746
|
+
</table>
|
747
|
+
</div>
|
748
|
+
|
749
|
+
<div class="method_details ">
|
750
|
+
<p class="signature " id="reverse_transition-instance_method">
|
751
|
+
|
752
|
+
- (<tt>StateMachine::Transition</tt>) <strong>reverse_transition</strong>(requirements = {})
|
753
|
+
|
754
|
+
|
755
|
+
|
756
|
+
</p><div class="docstring">
|
757
|
+
<div class="discussion">
|
758
|
+
<p>
|
759
|
+
Gets the next transition that would be performed if :reverse were to be
|
760
|
+
fired.
|
761
|
+
</p>
|
762
|
+
|
763
|
+
|
764
|
+
</div>
|
765
|
+
</div>
|
766
|
+
<div class="tags">
|
767
|
+
<h3>Parameters:</h3>
|
768
|
+
<ul class="param">
|
769
|
+
|
770
|
+
<li>
|
771
|
+
|
772
|
+
<span class='name'>requirements</span>
|
773
|
+
|
774
|
+
|
775
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
776
|
+
|
777
|
+
|
778
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
779
|
+
|
780
|
+
|
781
|
+
—
|
782
|
+
<div class='inline'><p>
|
783
|
+
The transition requirements to test against
|
784
|
+
</p>
|
785
|
+
</div>
|
786
|
+
|
787
|
+
</li>
|
788
|
+
|
789
|
+
</ul>
|
790
|
+
|
791
|
+
|
792
|
+
|
793
|
+
|
794
|
+
<h3>Options Hash (<tt>requirements</tt>):</h3>
|
795
|
+
<ul class="option">
|
796
|
+
|
797
|
+
<li>
|
798
|
+
<span class="name">:from</span>
|
799
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
800
|
+
<span class="default">
|
801
|
+
|
802
|
+
— default:
|
803
|
+
<tt>the current state</tt>
|
804
|
+
|
805
|
+
</span>
|
806
|
+
— <div class='inline'><p>
|
807
|
+
One or more initial states
|
808
|
+
</p>
|
809
|
+
</div>
|
810
|
+
</li>
|
811
|
+
|
812
|
+
<li>
|
813
|
+
<span class="name">:to</span>
|
814
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
815
|
+
<span class="default">
|
816
|
+
|
817
|
+
</span>
|
818
|
+
— <div class='inline'><p>
|
819
|
+
One or more target states
|
820
|
+
</p>
|
821
|
+
</div>
|
822
|
+
</li>
|
823
|
+
|
824
|
+
<li>
|
825
|
+
<span class="name">:guard</span>
|
826
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
827
|
+
<span class="default">
|
828
|
+
|
829
|
+
</span>
|
830
|
+
— <div class='inline'><p>
|
831
|
+
Whether to guard transitions with conditionals
|
832
|
+
</p>
|
833
|
+
</div>
|
834
|
+
</li>
|
835
|
+
|
836
|
+
</ul>
|
837
|
+
|
838
|
+
|
839
|
+
<h3>Returns:</h3>
|
840
|
+
<ul class="return">
|
841
|
+
|
842
|
+
<li>
|
843
|
+
|
844
|
+
|
845
|
+
<span class='type'>(<tt>StateMachine::Transition</tt>)</span>
|
846
|
+
|
847
|
+
|
848
|
+
|
849
|
+
—
|
850
|
+
<div class='inline'><p>
|
851
|
+
The transition that would be performed or <tt>nil</tt>
|
852
|
+
</p>
|
853
|
+
</div>
|
854
|
+
|
855
|
+
</li>
|
856
|
+
|
857
|
+
</ul>
|
858
|
+
|
859
|
+
</div><table class="source_code">
|
860
|
+
<tr>
|
861
|
+
<td>
|
862
|
+
<pre class="lines">
|
863
|
+
|
864
|
+
|
865
|
+
4
|
866
|
+
5
|
867
|
+
6
|
868
|
+
7
|
869
|
+
8
|
870
|
+
9
|
871
|
+
10
|
872
|
+
11
|
873
|
+
12
|
874
|
+
13
|
875
|
+
14
|
876
|
+
15
|
877
|
+
16
|
878
|
+
17
|
879
|
+
18
|
880
|
+
19
|
881
|
+
20</pre>
|
882
|
+
</td>
|
883
|
+
<td>
|
884
|
+
<pre class="code"><span class="info file"># File 'car.rb', line 4</span>
|
885
|
+
|
886
|
+
<span class='id identifier rubyid_state_machine'>state_machine</span> <span class='kw'>do</span>
|
887
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:reverse</span> <span class='kw'>do</span>
|
888
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='lbracket'>[</span><span class='symbol'>:parked</span><span class='comma'>,</span> <span class='symbol'>:idling</span><span class='comma'>,</span> <span class='symbol'>:first_gear</span><span class='rbracket'>]</span> <span class='op'>=></span> <span class='symbol'>:backing_up</span>
|
889
|
+
<span class='kw'>end</span>
|
890
|
+
|
891
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:park</span> <span class='kw'>do</span>
|
892
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:parked</span>
|
893
|
+
<span class='kw'>end</span>
|
894
|
+
|
895
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:idle</span> <span class='kw'>do</span>
|
896
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:idling</span>
|
897
|
+
<span class='kw'>end</span>
|
898
|
+
|
899
|
+
<span class='id identifier rubyid_event'>event</span> <span class='symbol'>:shift_up</span> <span class='kw'>do</span>
|
900
|
+
<span class='id identifier rubyid_transition'>transition</span> <span class='symbol'>:backing_up</span> <span class='op'>=></span> <span class='symbol'>:first_gear</span>
|
901
|
+
<span class='kw'>end</span>
|
902
|
+
<span class='kw'>end</span></pre>
|
903
|
+
</td>
|
904
|
+
</tr>
|
905
|
+
</table>
|
906
|
+
</div>
|
907
|
+
|
908
|
+
</div>
|
909
|
+
|
910
|
+
</div>
|
911
|
+
|
912
|
+
<div id="footer">
|
913
|
+
Generated on Fri Feb 17 08:30:34 2012 by
|
914
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
915
|
+
0.7.5 (ruby-1.9.2).
|
916
|
+
</div>
|
917
|
+
|
918
|
+
</body>
|
919
|
+
</html>
|