state_jacket 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -7,7 +7,6 @@ Gemfile.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
9
  coverage
10
- doc/
11
10
  lib/bundler/man
12
11
  pkg
13
12
  rdoc
data/README.md CHANGED
@@ -1,29 +1,73 @@
1
1
  # StateJacket
2
2
 
3
- TODO: Write a gem description
3
+ ## An Intuitive [State Transition System](http://en.wikipedia.org/wiki/State_transition_system)
4
4
 
5
- ## Installation
5
+ [State machines](http://en.wikipedia.org/wiki/Finite-state_machine) are awesome
6
+ but can be pretty daunting as a system grows.
7
+ Keeping states, transitions, & events straight can be tricky.
8
+ StateJacket simplifies things by isolating the management of states & transitions.
9
+ Events are left out, making it much easier to reason about what states exist
10
+ and how they transition to other states.
6
11
 
7
- Add this line to your application's Gemfile:
12
+ *The examples below are somewhat contrived, but should clearly illustrate the usage.*
8
13
 
9
- gem 'state_jacket'
14
+ ## Quick Start
10
15
 
11
- And then execute:
16
+ #### Install
12
17
 
13
- $ bundle
18
+ ```
19
+ $ gem install state_jacket
20
+ ```
14
21
 
15
- Or install it yourself as:
22
+ #### Define states & transitions for a simple [turnstyle](http://en.wikipedia.org/wiki/Finite-state_machine#Example:_a_turnstile).
16
23
 
17
- $ gem install state_jacket
24
+ ![Turnstyle](https://raw.github.com/hopsoft/state_jacket/master/doc/turnstyle.png)
18
25
 
19
- ## Usage
26
+ ```ruby
27
+ require "state_jacket"
20
28
 
21
- TODO: Write usage instructions here
29
+ states = StateJacket::Catalog.new
30
+ states.add :open => [:closed, :error]
31
+ states.add :closed => [:open, :error]
32
+ states.add :error
33
+ states.lock
22
34
 
23
- ## Contributing
35
+ states.transitioners # => [:open, :closed]
36
+ states.terminators # => [:error]
37
+
38
+ states.can_transition? :open => :closed # => true
39
+ states.can_transition? :closed => :open # => true
40
+ states.can_transition? :error => :open # => false
41
+ states.can_transition? :error => :closed # => false
42
+ ```
43
+
44
+ ## Next Steps
45
+
46
+ Lets model something a bit more complex.
47
+
48
+ #### Define states & transitions for a phone call.
49
+
50
+ ![Phone Call](https://raw.github.com/hopsoft/state_jacket/master/doc/phone-call.png)
51
+
52
+ ```ruby
53
+ require "state_jacket"
54
+
55
+ states = StateJacket::Catalog.new
56
+ states.add :idle => [:dialing]
57
+ states.add :dialing => [:idle, :connecting]
58
+ states.add :connecting => [:idle, :busy, :connected]
59
+ states.add :busy => [:idle]
60
+ states.add :connected => [:idle]
61
+ states.lock
62
+
63
+ states.transitioners # => [:idle, :dialing, :connecting, :busy, :connected]
64
+ states.terminators # => []
65
+
66
+ states.can_transition? :idle => :dialing # => true
67
+ states.can_transition? :dialing => [:idle, :connecting] # => true
68
+ states.can_transition? :connecting => [:idle, :busy, :connected] # => true
69
+ states.can_transition? :busy => :idle # => true
70
+ states.can_transition? :connected => :idle # => true
71
+ states.can_transition? :idle => [:dialing, :connected] # => false
72
+ ```
24
73
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
Binary file
@@ -0,0 +1,1050 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>ActiveLayerIndex</key>
6
+ <integer>0</integer>
7
+ <key>ApplicationVersion</key>
8
+ <array>
9
+ <string>com.omnigroup.OmniGraffle</string>
10
+ <string>139.16.0.171715</string>
11
+ </array>
12
+ <key>AutoAdjust</key>
13
+ <true/>
14
+ <key>BackgroundGraphic</key>
15
+ <dict>
16
+ <key>Bounds</key>
17
+ <string>{{0, 0}, {576, 733}}</string>
18
+ <key>Class</key>
19
+ <string>SolidGraphic</string>
20
+ <key>ID</key>
21
+ <integer>2</integer>
22
+ <key>Style</key>
23
+ <dict>
24
+ <key>shadow</key>
25
+ <dict>
26
+ <key>Draws</key>
27
+ <string>NO</string>
28
+ </dict>
29
+ <key>stroke</key>
30
+ <dict>
31
+ <key>Draws</key>
32
+ <string>NO</string>
33
+ </dict>
34
+ </dict>
35
+ </dict>
36
+ <key>BaseZoom</key>
37
+ <integer>0</integer>
38
+ <key>CanvasOrigin</key>
39
+ <string>{0, 0}</string>
40
+ <key>ColumnAlign</key>
41
+ <integer>1</integer>
42
+ <key>ColumnSpacing</key>
43
+ <real>36</real>
44
+ <key>CreationDate</key>
45
+ <string>2013-01-18 05:04:36 +0000</string>
46
+ <key>Creator</key>
47
+ <string>Nathan Hopkins</string>
48
+ <key>DisplayScale</key>
49
+ <string>1 0/72 in = 1 0/72 in</string>
50
+ <key>GraphDocumentVersion</key>
51
+ <integer>8</integer>
52
+ <key>GraphicsList</key>
53
+ <array>
54
+ <dict>
55
+ <key>Class</key>
56
+ <string>LineGraphic</string>
57
+ <key>ControlPoints</key>
58
+ <array>
59
+ <string>{0, 0}</string>
60
+ <string>{48, 0}</string>
61
+ <string>{-48.000083923094735, -0.00015339834698124832}</string>
62
+ <string>{37.094797509648544, -49.59713003872838}</string>
63
+ </array>
64
+ <key>ID</key>
65
+ <integer>50</integer>
66
+ <key>Points</key>
67
+ <array>
68
+ <string>{330.07120024286803, 315.78810586061013}</string>
69
+ <string>{256, 275}</string>
70
+ <string>{144, 326}</string>
71
+ </array>
72
+ <key>Style</key>
73
+ <dict>
74
+ <key>stroke</key>
75
+ <dict>
76
+ <key>Bezier</key>
77
+ <true/>
78
+ <key>HeadArrow</key>
79
+ <string>FilledArrow</string>
80
+ <key>Legacy</key>
81
+ <true/>
82
+ <key>LineType</key>
83
+ <integer>1</integer>
84
+ <key>Pattern</key>
85
+ <integer>2</integer>
86
+ <key>TailArrow</key>
87
+ <string>0</string>
88
+ </dict>
89
+ </dict>
90
+ <key>Tail</key>
91
+ <dict>
92
+ <key>ID</key>
93
+ <integer>37</integer>
94
+ </dict>
95
+ </dict>
96
+ <dict>
97
+ <key>Class</key>
98
+ <string>LineGraphic</string>
99
+ <key>ControlPoints</key>
100
+ <array>
101
+ <string>{0, 0}</string>
102
+ <string>{25.617828777393242, 49.065235507577029}</string>
103
+ </array>
104
+ <key>Head</key>
105
+ <dict>
106
+ <key>ID</key>
107
+ <integer>35</integer>
108
+ </dict>
109
+ <key>ID</key>
110
+ <integer>49</integer>
111
+ <key>Points</key>
112
+ <array>
113
+ <string>{204.36366096669116, 421.37913074010834}</string>
114
+ <string>{134.65929567493615, 365.59223326752374}</string>
115
+ </array>
116
+ <key>Style</key>
117
+ <dict>
118
+ <key>stroke</key>
119
+ <dict>
120
+ <key>Bezier</key>
121
+ <true/>
122
+ <key>HeadArrow</key>
123
+ <string>FilledArrow</string>
124
+ <key>Legacy</key>
125
+ <true/>
126
+ <key>LineType</key>
127
+ <integer>1</integer>
128
+ <key>Pattern</key>
129
+ <integer>2</integer>
130
+ <key>TailArrow</key>
131
+ <string>0</string>
132
+ </dict>
133
+ </dict>
134
+ <key>Tail</key>
135
+ <dict>
136
+ <key>ID</key>
137
+ <integer>47</integer>
138
+ </dict>
139
+ </dict>
140
+ <dict>
141
+ <key>Class</key>
142
+ <string>LineGraphic</string>
143
+ <key>ControlPoints</key>
144
+ <array>
145
+ <string>{0, 0}</string>
146
+ <string>{54.771091236693621, -7.3416922678176775}</string>
147
+ </array>
148
+ <key>Head</key>
149
+ <dict>
150
+ <key>ID</key>
151
+ <integer>47</integer>
152
+ </dict>
153
+ <key>ID</key>
154
+ <integer>48</integer>
155
+ <key>Points</key>
156
+ <array>
157
+ <string>{370, 382}</string>
158
+ <string>{279.4804014005955, 428.82048203417474}</string>
159
+ </array>
160
+ <key>Style</key>
161
+ <dict>
162
+ <key>stroke</key>
163
+ <dict>
164
+ <key>Bezier</key>
165
+ <true/>
166
+ <key>HeadArrow</key>
167
+ <string>FilledArrow</string>
168
+ <key>Legacy</key>
169
+ <true/>
170
+ <key>LineType</key>
171
+ <integer>1</integer>
172
+ <key>Pattern</key>
173
+ <integer>2</integer>
174
+ <key>TailArrow</key>
175
+ <string>0</string>
176
+ </dict>
177
+ </dict>
178
+ </dict>
179
+ <dict>
180
+ <key>Bounds</key>
181
+ <string>{{195, 405}, {89, 89}}</string>
182
+ <key>Class</key>
183
+ <string>ShapedGraphic</string>
184
+ <key>ID</key>
185
+ <integer>47</integer>
186
+ <key>Shape</key>
187
+ <string>Circle</string>
188
+ <key>Style</key>
189
+ <dict>
190
+ <key>fill</key>
191
+ <dict>
192
+ <key>Color</key>
193
+ <dict>
194
+ <key>a</key>
195
+ <string>0.1</string>
196
+ <key>b</key>
197
+ <string>0</string>
198
+ <key>g</key>
199
+ <string>0</string>
200
+ <key>r</key>
201
+ <string>1</string>
202
+ </dict>
203
+ </dict>
204
+ <key>shadow</key>
205
+ <dict>
206
+ <key>Draws</key>
207
+ <string>NO</string>
208
+ </dict>
209
+ </dict>
210
+ <key>Text</key>
211
+ <dict>
212
+ <key>Text</key>
213
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
214
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
215
+ {\colortbl;\red255\green255\blue255;}
216
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
217
+
218
+ \f0\fs24 \cf0 busy}</string>
219
+ <key>VerticalPad</key>
220
+ <integer>0</integer>
221
+ </dict>
222
+ </dict>
223
+ <dict>
224
+ <key>Class</key>
225
+ <string>LineGraphic</string>
226
+ <key>ControlPoints</key>
227
+ <array>
228
+ <string>{0, 0}</string>
229
+ <string>{99, 0}</string>
230
+ <string>{-99.000152587764234, -0.000158192012577274}</string>
231
+ <string>{37.094797509648544, -49.59713003872838}</string>
232
+ </array>
233
+ <key>Head</key>
234
+ <dict>
235
+ <key>ID</key>
236
+ <integer>35</integer>
237
+ </dict>
238
+ <key>ID</key>
239
+ <integer>45</integer>
240
+ <key>Points</key>
241
+ <array>
242
+ <string>{462.5870894611333, 321.08902939464093}</string>
243
+ <string>{327, 268}</string>
244
+ <string>{142.544987120353, 324.3499929456504}</string>
245
+ </array>
246
+ <key>Style</key>
247
+ <dict>
248
+ <key>stroke</key>
249
+ <dict>
250
+ <key>Bezier</key>
251
+ <true/>
252
+ <key>HeadArrow</key>
253
+ <string>FilledArrow</string>
254
+ <key>Legacy</key>
255
+ <true/>
256
+ <key>LineType</key>
257
+ <integer>1</integer>
258
+ <key>Pattern</key>
259
+ <integer>2</integer>
260
+ <key>TailArrow</key>
261
+ <string>0</string>
262
+ </dict>
263
+ </dict>
264
+ <key>Tail</key>
265
+ <dict>
266
+ <key>ID</key>
267
+ <integer>38</integer>
268
+ </dict>
269
+ </dict>
270
+ <dict>
271
+ <key>Class</key>
272
+ <string>LineGraphic</string>
273
+ <key>Head</key>
274
+ <dict>
275
+ <key>ID</key>
276
+ <integer>38</integer>
277
+ </dict>
278
+ <key>ID</key>
279
+ <integer>44</integer>
280
+ <key>Points</key>
281
+ <array>
282
+ <string>{414.50002226387079, 337.50001262676926}</string>
283
+ <string>{459.49997773612739, 337.50001262676926}</string>
284
+ </array>
285
+ <key>Style</key>
286
+ <dict>
287
+ <key>stroke</key>
288
+ <dict>
289
+ <key>HeadArrow</key>
290
+ <string>FilledArrow</string>
291
+ <key>Legacy</key>
292
+ <true/>
293
+ <key>Pattern</key>
294
+ <integer>2</integer>
295
+ <key>TailArrow</key>
296
+ <string>0</string>
297
+ </dict>
298
+ </dict>
299
+ <key>Tail</key>
300
+ <dict>
301
+ <key>ID</key>
302
+ <integer>37</integer>
303
+ </dict>
304
+ </dict>
305
+ <dict>
306
+ <key>Class</key>
307
+ <string>LineGraphic</string>
308
+ <key>Head</key>
309
+ <dict>
310
+ <key>ID</key>
311
+ <integer>37</integer>
312
+ </dict>
313
+ <key>ID</key>
314
+ <integer>43</integer>
315
+ <key>Points</key>
316
+ <array>
317
+ <string>{279.50002226387113, 337.50001164932081}</string>
318
+ <string>{324.49997773612716, 337.50001164932081}</string>
319
+ </array>
320
+ <key>Style</key>
321
+ <dict>
322
+ <key>stroke</key>
323
+ <dict>
324
+ <key>HeadArrow</key>
325
+ <string>FilledArrow</string>
326
+ <key>Legacy</key>
327
+ <true/>
328
+ <key>Pattern</key>
329
+ <integer>2</integer>
330
+ <key>TailArrow</key>
331
+ <string>0</string>
332
+ </dict>
333
+ </dict>
334
+ <key>Tail</key>
335
+ <dict>
336
+ <key>ID</key>
337
+ <integer>36</integer>
338
+ </dict>
339
+ </dict>
340
+ <dict>
341
+ <key>Class</key>
342
+ <string>LineGraphic</string>
343
+ <key>ControlPoints</key>
344
+ <array>
345
+ <string>{0, 0}</string>
346
+ <string>{13, 2}</string>
347
+ <string>{-13.000010253293624, -1.9999962966496696}</string>
348
+ <string>{11.295010592684577, -10.887363340721549}</string>
349
+ </array>
350
+ <key>Head</key>
351
+ <dict>
352
+ <key>ID</key>
353
+ <integer>35</integer>
354
+ </dict>
355
+ <key>ID</key>
356
+ <integer>42</integer>
357
+ <key>Points</key>
358
+ <array>
359
+ <string>{193.16690090653196, 319.67747103309176}</string>
360
+ <string>{180, 314}</string>
361
+ <string>{142.70498940731542, 324.88736334072155}</string>
362
+ </array>
363
+ <key>Style</key>
364
+ <dict>
365
+ <key>stroke</key>
366
+ <dict>
367
+ <key>Bezier</key>
368
+ <true/>
369
+ <key>HeadArrow</key>
370
+ <string>FilledArrow</string>
371
+ <key>Legacy</key>
372
+ <true/>
373
+ <key>LineType</key>
374
+ <integer>1</integer>
375
+ <key>Pattern</key>
376
+ <integer>2</integer>
377
+ <key>TailArrow</key>
378
+ <string>0</string>
379
+ </dict>
380
+ </dict>
381
+ <key>Tail</key>
382
+ <dict>
383
+ <key>ID</key>
384
+ <integer>36</integer>
385
+ </dict>
386
+ </dict>
387
+ <dict>
388
+ <key>Class</key>
389
+ <string>LineGraphic</string>
390
+ <key>Head</key>
391
+ <dict>
392
+ <key>ID</key>
393
+ <integer>36</integer>
394
+ </dict>
395
+ <key>ID</key>
396
+ <integer>41</integer>
397
+ <key>Points</key>
398
+ <array>
399
+ <string>{144.50002226387093, 337.49998113969713}</string>
400
+ <string>{189.49997773613177, 337.49998113969713}</string>
401
+ </array>
402
+ <key>Style</key>
403
+ <dict>
404
+ <key>stroke</key>
405
+ <dict>
406
+ <key>HeadArrow</key>
407
+ <string>FilledArrow</string>
408
+ <key>Legacy</key>
409
+ <true/>
410
+ <key>Pattern</key>
411
+ <integer>2</integer>
412
+ <key>TailArrow</key>
413
+ <string>0</string>
414
+ </dict>
415
+ </dict>
416
+ <key>Tail</key>
417
+ <dict>
418
+ <key>ID</key>
419
+ <integer>35</integer>
420
+ </dict>
421
+ </dict>
422
+ <dict>
423
+ <key>Bounds</key>
424
+ <string>{{460, 293}, {89, 89}}</string>
425
+ <key>Class</key>
426
+ <string>ShapedGraphic</string>
427
+ <key>ID</key>
428
+ <integer>38</integer>
429
+ <key>Shape</key>
430
+ <string>Circle</string>
431
+ <key>Style</key>
432
+ <dict>
433
+ <key>fill</key>
434
+ <dict>
435
+ <key>Color</key>
436
+ <dict>
437
+ <key>a</key>
438
+ <string>0.15</string>
439
+ <key>b</key>
440
+ <string>0</string>
441
+ <key>g</key>
442
+ <string>1</string>
443
+ <key>r</key>
444
+ <string>0</string>
445
+ </dict>
446
+ </dict>
447
+ <key>shadow</key>
448
+ <dict>
449
+ <key>Draws</key>
450
+ <string>NO</string>
451
+ </dict>
452
+ </dict>
453
+ <key>Text</key>
454
+ <dict>
455
+ <key>Text</key>
456
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
457
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
458
+ {\colortbl;\red255\green255\blue255;}
459
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
460
+
461
+ \f0\fs24 \cf0 connected}</string>
462
+ <key>VerticalPad</key>
463
+ <integer>0</integer>
464
+ </dict>
465
+ </dict>
466
+ <dict>
467
+ <key>Bounds</key>
468
+ <string>{{325, 293}, {89, 89}}</string>
469
+ <key>Class</key>
470
+ <string>ShapedGraphic</string>
471
+ <key>ID</key>
472
+ <integer>37</integer>
473
+ <key>Shape</key>
474
+ <string>Circle</string>
475
+ <key>Style</key>
476
+ <dict>
477
+ <key>fill</key>
478
+ <dict>
479
+ <key>Color</key>
480
+ <dict>
481
+ <key>a</key>
482
+ <string>0.05</string>
483
+ <key>b</key>
484
+ <string>0</string>
485
+ <key>g</key>
486
+ <string>1</string>
487
+ <key>r</key>
488
+ <string>0</string>
489
+ </dict>
490
+ </dict>
491
+ <key>shadow</key>
492
+ <dict>
493
+ <key>Draws</key>
494
+ <string>NO</string>
495
+ </dict>
496
+ </dict>
497
+ <key>Text</key>
498
+ <dict>
499
+ <key>Text</key>
500
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
501
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
502
+ {\colortbl;\red255\green255\blue255;}
503
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
504
+
505
+ \f0\fs24 \cf0 connecting}</string>
506
+ <key>VerticalPad</key>
507
+ <integer>0</integer>
508
+ </dict>
509
+ </dict>
510
+ <dict>
511
+ <key>Bounds</key>
512
+ <string>{{190, 293}, {89, 89}}</string>
513
+ <key>Class</key>
514
+ <string>ShapedGraphic</string>
515
+ <key>ID</key>
516
+ <integer>36</integer>
517
+ <key>Shape</key>
518
+ <string>Circle</string>
519
+ <key>Style</key>
520
+ <dict>
521
+ <key>fill</key>
522
+ <dict>
523
+ <key>Color</key>
524
+ <dict>
525
+ <key>a</key>
526
+ <string>0.02</string>
527
+ <key>b</key>
528
+ <string>0</string>
529
+ <key>g</key>
530
+ <string>1</string>
531
+ <key>r</key>
532
+ <string>0</string>
533
+ </dict>
534
+ </dict>
535
+ <key>shadow</key>
536
+ <dict>
537
+ <key>Draws</key>
538
+ <string>NO</string>
539
+ </dict>
540
+ </dict>
541
+ <key>Text</key>
542
+ <dict>
543
+ <key>Text</key>
544
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
545
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
546
+ {\colortbl;\red255\green255\blue255;}
547
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
548
+
549
+ \f0\fs24 \cf0 dialing}</string>
550
+ <key>VerticalPad</key>
551
+ <integer>0</integer>
552
+ </dict>
553
+ </dict>
554
+ <dict>
555
+ <key>Bounds</key>
556
+ <string>{{55, 293}, {89, 89}}</string>
557
+ <key>Class</key>
558
+ <string>ShapedGraphic</string>
559
+ <key>ID</key>
560
+ <integer>35</integer>
561
+ <key>Shape</key>
562
+ <string>Circle</string>
563
+ <key>Style</key>
564
+ <dict>
565
+ <key>fill</key>
566
+ <dict>
567
+ <key>Color</key>
568
+ <dict>
569
+ <key>a</key>
570
+ <string>0.1</string>
571
+ <key>b</key>
572
+ <string>0.4</string>
573
+ <key>g</key>
574
+ <string>0.8</string>
575
+ <key>r</key>
576
+ <string>1</string>
577
+ </dict>
578
+ </dict>
579
+ <key>shadow</key>
580
+ <dict>
581
+ <key>Draws</key>
582
+ <string>NO</string>
583
+ </dict>
584
+ </dict>
585
+ <key>Text</key>
586
+ <dict>
587
+ <key>Text</key>
588
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
589
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
590
+ {\colortbl;\red255\green255\blue255;}
591
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
592
+
593
+ \f0\fs24 \cf0 idle}</string>
594
+ <key>VerticalPad</key>
595
+ <integer>0</integer>
596
+ </dict>
597
+ </dict>
598
+ <dict>
599
+ <key>Class</key>
600
+ <string>LineGraphic</string>
601
+ <key>Head</key>
602
+ <dict>
603
+ <key>ID</key>
604
+ <integer>32</integer>
605
+ </dict>
606
+ <key>ID</key>
607
+ <integer>34</integer>
608
+ <key>Points</key>
609
+ <array>
610
+ <string>{325.49997774527952, 147.49998100009384}</string>
611
+ <string>{284.50001550472143, 147.49998100009384}</string>
612
+ </array>
613
+ <key>Style</key>
614
+ <dict>
615
+ <key>stroke</key>
616
+ <dict>
617
+ <key>HeadArrow</key>
618
+ <string>FilledArrow</string>
619
+ <key>Legacy</key>
620
+ <true/>
621
+ <key>Pattern</key>
622
+ <integer>2</integer>
623
+ <key>TailArrow</key>
624
+ <string>0</string>
625
+ </dict>
626
+ </dict>
627
+ <key>Tail</key>
628
+ <dict>
629
+ <key>ID</key>
630
+ <integer>29</integer>
631
+ </dict>
632
+ </dict>
633
+ <dict>
634
+ <key>Class</key>
635
+ <string>LineGraphic</string>
636
+ <key>Head</key>
637
+ <dict>
638
+ <key>ID</key>
639
+ <integer>32</integer>
640
+ </dict>
641
+ <key>ID</key>
642
+ <integer>33</integer>
643
+ <key>Points</key>
644
+ <array>
645
+ <string>{180.50002225472181, 147.50001608531829}</string>
646
+ <string>{221.49998449527712, 147.50001608531829}</string>
647
+ </array>
648
+ <key>Style</key>
649
+ <dict>
650
+ <key>stroke</key>
651
+ <dict>
652
+ <key>HeadArrow</key>
653
+ <string>FilledArrow</string>
654
+ <key>Legacy</key>
655
+ <true/>
656
+ <key>Pattern</key>
657
+ <integer>2</integer>
658
+ <key>TailArrow</key>
659
+ <string>0</string>
660
+ </dict>
661
+ </dict>
662
+ <key>Tail</key>
663
+ <dict>
664
+ <key>ID</key>
665
+ <integer>28</integer>
666
+ </dict>
667
+ </dict>
668
+ <dict>
669
+ <key>Bounds</key>
670
+ <string>{{222, 116.5}, {62, 62}}</string>
671
+ <key>Class</key>
672
+ <string>ShapedGraphic</string>
673
+ <key>ID</key>
674
+ <integer>32</integer>
675
+ <key>Shape</key>
676
+ <string>Circle</string>
677
+ <key>Style</key>
678
+ <dict>
679
+ <key>fill</key>
680
+ <dict>
681
+ <key>Color</key>
682
+ <dict>
683
+ <key>a</key>
684
+ <string>0.1</string>
685
+ <key>b</key>
686
+ <string>0</string>
687
+ <key>g</key>
688
+ <string>0</string>
689
+ <key>r</key>
690
+ <string>1</string>
691
+ </dict>
692
+ </dict>
693
+ <key>shadow</key>
694
+ <dict>
695
+ <key>Draws</key>
696
+ <string>NO</string>
697
+ </dict>
698
+ </dict>
699
+ <key>Text</key>
700
+ <dict>
701
+ <key>Text</key>
702
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
703
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
704
+ {\colortbl;\red255\green255\blue255;}
705
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
706
+
707
+ \f0\fs24 \cf0 error}</string>
708
+ <key>VerticalPad</key>
709
+ <integer>0</integer>
710
+ </dict>
711
+ </dict>
712
+ <dict>
713
+ <key>Class</key>
714
+ <string>LineGraphic</string>
715
+ <key>ControlPoints</key>
716
+ <array>
717
+ <string>{0, 0}</string>
718
+ <string>{37.375, -0.5}</string>
719
+ <string>{-37.375019998015745, 0.50001755127379965}</string>
720
+ <string>{-6.4017063365794797, -9.42273629316756}</string>
721
+ </array>
722
+ <key>Head</key>
723
+ <dict>
724
+ <key>ID</key>
725
+ <integer>28</integer>
726
+ </dict>
727
+ <key>ID</key>
728
+ <integer>31</integer>
729
+ <key>Points</key>
730
+ <array>
731
+ <string>{329.27407235914586, 165.5692363702467}</string>
732
+ <string>{253, 199}</string>
733
+ <string>{176.7259248945559, 165.56923516655002}</string>
734
+ </array>
735
+ <key>Style</key>
736
+ <dict>
737
+ <key>stroke</key>
738
+ <dict>
739
+ <key>Bezier</key>
740
+ <true/>
741
+ <key>HeadArrow</key>
742
+ <string>FilledArrow</string>
743
+ <key>Legacy</key>
744
+ <true/>
745
+ <key>LineType</key>
746
+ <integer>1</integer>
747
+ <key>Pattern</key>
748
+ <integer>2</integer>
749
+ <key>TailArrow</key>
750
+ <string>0</string>
751
+ </dict>
752
+ </dict>
753
+ <key>Tail</key>
754
+ <dict>
755
+ <key>ID</key>
756
+ <integer>29</integer>
757
+ </dict>
758
+ </dict>
759
+ <dict>
760
+ <key>Class</key>
761
+ <string>LineGraphic</string>
762
+ <key>ControlPoints</key>
763
+ <array>
764
+ <string>{0, 0}</string>
765
+ <string>{-32, 0}</string>
766
+ <string>{32.000011444091797, 0}</string>
767
+ <string>{-6.4017063365794797, -9.42273629316756}</string>
768
+ </array>
769
+ <key>Head</key>
770
+ <dict>
771
+ <key>ID</key>
772
+ <integer>29</integer>
773
+ </dict>
774
+ <key>ID</key>
775
+ <integer>30</integer>
776
+ <key>Points</key>
777
+ <array>
778
+ <string>{176.5375494262741, 129.00668373494085}</string>
779
+ <string>{252, 95}</string>
780
+ <string>{329.34608384097965, 129.26725233461124}</string>
781
+ </array>
782
+ <key>Style</key>
783
+ <dict>
784
+ <key>stroke</key>
785
+ <dict>
786
+ <key>Bezier</key>
787
+ <true/>
788
+ <key>HeadArrow</key>
789
+ <string>FilledArrow</string>
790
+ <key>Legacy</key>
791
+ <true/>
792
+ <key>LineType</key>
793
+ <integer>1</integer>
794
+ <key>Pattern</key>
795
+ <integer>2</integer>
796
+ <key>TailArrow</key>
797
+ <string>0</string>
798
+ </dict>
799
+ </dict>
800
+ <key>Tail</key>
801
+ <dict>
802
+ <key>ID</key>
803
+ <integer>28</integer>
804
+ </dict>
805
+ </dict>
806
+ <dict>
807
+ <key>Bounds</key>
808
+ <string>{{326, 103}, {89, 89}}</string>
809
+ <key>Class</key>
810
+ <string>ShapedGraphic</string>
811
+ <key>ID</key>
812
+ <integer>29</integer>
813
+ <key>Shape</key>
814
+ <string>Circle</string>
815
+ <key>Style</key>
816
+ <dict>
817
+ <key>fill</key>
818
+ <dict>
819
+ <key>Color</key>
820
+ <dict>
821
+ <key>a</key>
822
+ <string>0.1</string>
823
+ <key>b</key>
824
+ <string>0.4</string>
825
+ <key>g</key>
826
+ <string>1</string>
827
+ <key>r</key>
828
+ <string>0.4</string>
829
+ </dict>
830
+ </dict>
831
+ <key>shadow</key>
832
+ <dict>
833
+ <key>Draws</key>
834
+ <string>NO</string>
835
+ </dict>
836
+ </dict>
837
+ <key>Text</key>
838
+ <dict>
839
+ <key>Text</key>
840
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
841
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
842
+ {\colortbl;\red255\green255\blue255;}
843
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
844
+
845
+ \f0\fs24 \cf0 open}</string>
846
+ <key>VerticalPad</key>
847
+ <integer>0</integer>
848
+ </dict>
849
+ </dict>
850
+ <dict>
851
+ <key>Bounds</key>
852
+ <string>{{91, 103}, {89, 89}}</string>
853
+ <key>Class</key>
854
+ <string>ShapedGraphic</string>
855
+ <key>ID</key>
856
+ <integer>28</integer>
857
+ <key>Shape</key>
858
+ <string>Circle</string>
859
+ <key>Style</key>
860
+ <dict>
861
+ <key>fill</key>
862
+ <dict>
863
+ <key>Color</key>
864
+ <dict>
865
+ <key>a</key>
866
+ <string>0.1</string>
867
+ <key>b</key>
868
+ <string>0.4</string>
869
+ <key>g</key>
870
+ <string>0.8</string>
871
+ <key>r</key>
872
+ <string>1</string>
873
+ </dict>
874
+ </dict>
875
+ <key>shadow</key>
876
+ <dict>
877
+ <key>Draws</key>
878
+ <string>NO</string>
879
+ </dict>
880
+ </dict>
881
+ <key>Text</key>
882
+ <dict>
883
+ <key>Text</key>
884
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
885
+ {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
886
+ {\colortbl;\red255\green255\blue255;}
887
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
888
+
889
+ \f0\fs24 \cf0 closed}</string>
890
+ <key>VerticalPad</key>
891
+ <integer>0</integer>
892
+ </dict>
893
+ </dict>
894
+ </array>
895
+ <key>GridInfo</key>
896
+ <dict/>
897
+ <key>GuidesLocked</key>
898
+ <string>NO</string>
899
+ <key>GuidesVisible</key>
900
+ <string>YES</string>
901
+ <key>HPages</key>
902
+ <integer>1</integer>
903
+ <key>ImageCounter</key>
904
+ <integer>1</integer>
905
+ <key>KeepToScale</key>
906
+ <false/>
907
+ <key>Layers</key>
908
+ <array>
909
+ <dict>
910
+ <key>Lock</key>
911
+ <string>NO</string>
912
+ <key>Name</key>
913
+ <string>Layer 1</string>
914
+ <key>Print</key>
915
+ <string>YES</string>
916
+ <key>View</key>
917
+ <string>YES</string>
918
+ </dict>
919
+ </array>
920
+ <key>LayoutInfo</key>
921
+ <dict>
922
+ <key>Animate</key>
923
+ <string>NO</string>
924
+ <key>circoMinDist</key>
925
+ <real>18</real>
926
+ <key>circoSeparation</key>
927
+ <real>0.0</real>
928
+ <key>layoutEngine</key>
929
+ <string>dot</string>
930
+ <key>neatoSeparation</key>
931
+ <real>0.0</real>
932
+ <key>twopiSeparation</key>
933
+ <real>0.0</real>
934
+ </dict>
935
+ <key>LinksVisible</key>
936
+ <string>NO</string>
937
+ <key>MagnetsVisible</key>
938
+ <string>NO</string>
939
+ <key>MasterSheets</key>
940
+ <array/>
941
+ <key>ModificationDate</key>
942
+ <string>2013-01-18 06:13:02 +0000</string>
943
+ <key>Modifier</key>
944
+ <string>Nathan Hopkins</string>
945
+ <key>NotesVisible</key>
946
+ <string>NO</string>
947
+ <key>Orientation</key>
948
+ <integer>2</integer>
949
+ <key>OriginVisible</key>
950
+ <string>NO</string>
951
+ <key>PageBreaks</key>
952
+ <string>YES</string>
953
+ <key>PrintInfo</key>
954
+ <dict>
955
+ <key>NSBottomMargin</key>
956
+ <array>
957
+ <string>float</string>
958
+ <string>41</string>
959
+ </array>
960
+ <key>NSHorizonalPagination</key>
961
+ <array>
962
+ <string>coded</string>
963
+ <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string>
964
+ </array>
965
+ <key>NSLeftMargin</key>
966
+ <array>
967
+ <string>float</string>
968
+ <string>18</string>
969
+ </array>
970
+ <key>NSPaperSize</key>
971
+ <array>
972
+ <string>size</string>
973
+ <string>{612, 792}</string>
974
+ </array>
975
+ <key>NSPrintReverseOrientation</key>
976
+ <array>
977
+ <string>int</string>
978
+ <string>0</string>
979
+ </array>
980
+ <key>NSRightMargin</key>
981
+ <array>
982
+ <string>float</string>
983
+ <string>18</string>
984
+ </array>
985
+ <key>NSTopMargin</key>
986
+ <array>
987
+ <string>float</string>
988
+ <string>18</string>
989
+ </array>
990
+ </dict>
991
+ <key>PrintOnePage</key>
992
+ <false/>
993
+ <key>ReadOnly</key>
994
+ <string>NO</string>
995
+ <key>RowAlign</key>
996
+ <integer>1</integer>
997
+ <key>RowSpacing</key>
998
+ <real>36</real>
999
+ <key>SheetTitle</key>
1000
+ <string>Canvas 1</string>
1001
+ <key>SmartAlignmentGuidesActive</key>
1002
+ <string>YES</string>
1003
+ <key>SmartDistanceGuidesActive</key>
1004
+ <string>YES</string>
1005
+ <key>UniqueID</key>
1006
+ <integer>1</integer>
1007
+ <key>UseEntirePage</key>
1008
+ <false/>
1009
+ <key>VPages</key>
1010
+ <integer>1</integer>
1011
+ <key>WindowInfo</key>
1012
+ <dict>
1013
+ <key>CurrentSheet</key>
1014
+ <integer>0</integer>
1015
+ <key>ExpandedCanvases</key>
1016
+ <array>
1017
+ <dict>
1018
+ <key>name</key>
1019
+ <string>Canvas 1</string>
1020
+ </dict>
1021
+ </array>
1022
+ <key>Frame</key>
1023
+ <string>{{-1702, 11}, {1165, 990}}</string>
1024
+ <key>ListView</key>
1025
+ <true/>
1026
+ <key>OutlineWidth</key>
1027
+ <integer>142</integer>
1028
+ <key>RightSidebar</key>
1029
+ <false/>
1030
+ <key>ShowRuler</key>
1031
+ <true/>
1032
+ <key>Sidebar</key>
1033
+ <true/>
1034
+ <key>SidebarWidth</key>
1035
+ <integer>120</integer>
1036
+ <key>VisibleRegion</key>
1037
+ <string>{{-227, -59}, {1030, 851}}</string>
1038
+ <key>Zoom</key>
1039
+ <real>1</real>
1040
+ <key>ZoomValues</key>
1041
+ <array>
1042
+ <array>
1043
+ <string>Canvas 1</string>
1044
+ <real>1</real>
1045
+ <real>8</real>
1046
+ </array>
1047
+ </array>
1048
+ </dict>
1049
+ </dict>
1050
+ </plist>
data/doc/turnstyle.png ADDED
Binary file
@@ -38,10 +38,10 @@ module StateJacket
38
38
  end
39
39
 
40
40
  def lock
41
- values.each do |value|
41
+ values.flatten.each do |value|
42
42
  next if value.nil?
43
- if (keys & value).length != value.length
44
- raise "Invalid StateCatalog! #{value} is not a first class state."
43
+ if !keys.include?(value)
44
+ raise "Invalid StateJacket::Catalog! [#{value}] is not a first class state."
45
45
  end
46
46
  end
47
47
  freeze
@@ -1,3 +1,3 @@
1
1
  module StateJacket
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_jacket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-16 00:00:00.000000000 Z
12
+ date: 2013-01-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email:
@@ -23,6 +23,9 @@ files:
23
23
  - LICENSE.txt
24
24
  - README.md
25
25
  - Rakefile
26
+ - doc/phone-call.png
27
+ - doc/turnstyle.graffle
28
+ - doc/turnstyle.png
26
29
  - lib/state_jacket.rb
27
30
  - lib/state_jacket/catalog.rb
28
31
  - lib/state_jacket/version.rb
@@ -47,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
50
  version: '0'
48
51
  requirements: []
49
52
  rubyforge_project:
50
- rubygems_version: 1.8.24
53
+ rubygems_version: 1.8.23
51
54
  signing_key:
52
55
  specification_version: 3
53
56
  summary: Intuitively define state machine like states and transitions.