ruby-state-mach 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.rdoc +37 -7
- data/lib/ruby-state-machine.rb +1 -1
- metadata +4 -4
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,26 +1,56 @@
|
|
1
1
|
= ruby-state-machine
|
2
2
|
|
3
|
-
*
|
3
|
+
* http://rubyforge.org/projects/ruby-state-mach/
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
7
|
+
An enhanced state machine gem for ruby (doesn't require Rails). Provides more robust DSL state declaration syntax than other state machines. Multiple "actions" per event (i.e., next state, labmda, or a "decider".
|
8
8
|
|
9
9
|
== FEATURES/PROBLEMS:
|
10
10
|
|
11
|
-
|
11
|
+
|
12
12
|
|
13
13
|
== SYNOPSIS:
|
14
14
|
|
15
|
-
|
15
|
+
class StateMachineFixture
|
16
|
+
include StateMachine
|
17
|
+
attr_accessor :test_val, :prev_test_val, :proc_val, :force_decide_nil, :name_for_decider
|
16
18
|
|
17
|
-
== REQUIREMENTS:
|
18
19
|
|
19
|
-
|
20
|
+
state_machine :states => [:a_state, :b_state, :c_state, :d_state], :events => [:w_event, :x_event, :y_event, :z_event]
|
21
|
+
state_transition :state=>:a_state, :event=>:w_event, :next=>{:state=>:b_state, :action=>lambda{|o, args| o.increment_value(5)} }
|
22
|
+
state_transition :state=>:a_state, :event=>:x_event, :next=>:c_state
|
23
|
+
state_transition :state=>:a_state, :event=>:y_event, :next=>:a_state
|
24
|
+
state_transition :state=>:a_state, :event=>:z_event, :next=>:b_state
|
25
|
+
|
26
|
+
state_transition :state=>:b_state, :event=>:w_event, :next=>:b_state
|
27
|
+
state_transition :state=>:b_state, :event=>:y_event, :next=>:c_state
|
28
|
+
state_transition :state=>:b_state, :event=>:z_event, :next=>:a_state
|
29
|
+
|
30
|
+
state_transition :state=>:c_state, :event=>:x_event, :next=>:b_state
|
31
|
+
state_transition :state=>:c_state, :event=>:y_event, :next=>{:state=>:a_state, :action=>lambda{|o, args| o.increment_value(-3)}}
|
32
|
+
|
33
|
+
state_transition :state=>:c_state, :event=>:w_event, :decider => :c_state_decider,
|
34
|
+
:next=>[
|
35
|
+
{:state=>:a_state, :action=>lambda{|o, args| o.increment_value(7)} },
|
36
|
+
{:state=>:b_state, :action=>lambda{|o, args| o.increment_value(-10)} }
|
37
|
+
]
|
38
|
+
|
39
|
+
state_transition :state=>:c_state, :event=>:z_event , :decider => :named_action_decider,
|
40
|
+
:next=>[
|
41
|
+
{:name=>"foo", :state=>:a_state, :action=>lambda{|o, args| o.increment_value(7)} },
|
42
|
+
{:name=>"bar", :state=>:d_state, :action=>lambda{|o, args| o.increment_value(-10)} }
|
43
|
+
]
|
44
|
+
|
45
|
+
state_transition :state=>:d_state, :event=>:x_event, :next=>:stay
|
46
|
+
|
47
|
+
|
48
|
+
== REQUIREMENTS:
|
49
|
+
Ruby
|
20
50
|
|
21
51
|
== INSTALL:
|
22
52
|
|
23
|
-
*
|
53
|
+
* sudo gem install ruby-state-mach
|
24
54
|
|
25
55
|
== LICENSE:
|
26
56
|
|
data/lib/ruby-state-machine.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-state-mach
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stevenmiers
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.8.0
|
34
34
|
version:
|
35
|
-
description:
|
35
|
+
description: An enhanced state machine gem for ruby (doesn't require Rails). Provides more robust DSL state declaration syntax than other state machines. Multiple "actions" per event (i.e., next state, labmda, or a "decider".
|
36
36
|
email:
|
37
37
|
- steven.miers@gmail.com
|
38
38
|
executables: []
|
@@ -57,7 +57,7 @@ files:
|
|
57
57
|
- test/test_helper.rb
|
58
58
|
- test/test_state_machine.rb
|
59
59
|
has_rdoc: true
|
60
|
-
homepage:
|
60
|
+
homepage: http://rubyforge.org/projects/ruby-state-mach/
|
61
61
|
post_install_message: PostInstall.txt
|
62
62
|
rdoc_options:
|
63
63
|
- --main
|
@@ -82,7 +82,7 @@ rubyforge_project: ruby-state-mach
|
|
82
82
|
rubygems_version: 1.3.1
|
83
83
|
signing_key:
|
84
84
|
specification_version: 2
|
85
|
-
summary:
|
85
|
+
summary: An enhanced state machine gem for ruby (doesn't require Rails)
|
86
86
|
test_files:
|
87
87
|
- test/test_helper.rb
|
88
88
|
- test/test_state_machine.rb
|