verborghs-state_machine 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/state_machine/condition_proxy.rb +3 -3
- metadata +133 -130
@@ -66,7 +66,7 @@ module StateMachine
|
|
66
66
|
end
|
67
67
|
|
68
68
|
# Get any existing condition that may need to be merged
|
69
|
-
wrap_condition(options)
|
69
|
+
wrap_condition(options, true)
|
70
70
|
|
71
71
|
# Evaluate the method on the original class with the condition proxied
|
72
72
|
# through
|
@@ -74,7 +74,7 @@ module StateMachine
|
|
74
74
|
end
|
75
75
|
|
76
76
|
protected
|
77
|
-
def wrap_condition(options)
|
77
|
+
def wrap_condition(options, force = false)
|
78
78
|
if_condition = options.delete(:if)
|
79
79
|
unless_condition = options.delete(:unless)
|
80
80
|
|
@@ -93,7 +93,7 @@ module StateMachine
|
|
93
93
|
proxy.evaluate_method(object, proxy_condition) &&
|
94
94
|
Array(if_condition).all? {|condition| proxy.evaluate_method(object, condition)} &&
|
95
95
|
!Array(unless_condition).any? {|condition| proxy.evaluate_method(object, condition)}
|
96
|
-
end
|
96
|
+
end if (force || !if_condition.nil? || !unless_condition.nil? )
|
97
97
|
|
98
98
|
# Needed for active record when presence => { :if => :something? }
|
99
99
|
options.each do |key, value|
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verborghs-state_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 55
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
version: 0.9.
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 6
|
10
|
+
version: 0.9.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
|
-
|
13
|
+
- Aaron Pfeifer
|
13
14
|
autorequire:
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
@@ -27,94 +28,94 @@ extensions: []
|
|
27
28
|
extra_rdoc_files: []
|
28
29
|
|
29
30
|
files:
|
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
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
31
|
+
- examples/AutoShop_state.png
|
32
|
+
- examples/vehicle.rb
|
33
|
+
- examples/car.rb
|
34
|
+
- examples/Vehicle_state.png
|
35
|
+
- examples/rails-rest/view_index.html.erb
|
36
|
+
- examples/rails-rest/view_new.html.erb
|
37
|
+
- examples/rails-rest/view_show.html.erb
|
38
|
+
- examples/rails-rest/controller.rb
|
39
|
+
- examples/rails-rest/view_edit.html.erb
|
40
|
+
- examples/rails-rest/model.rb
|
41
|
+
- examples/rails-rest/migration.rb
|
42
|
+
- examples/Car_state.png
|
43
|
+
- examples/traffic_light.rb
|
44
|
+
- examples/merb-rest/view_index.html.erb
|
45
|
+
- examples/merb-rest/view_new.html.erb
|
46
|
+
- examples/merb-rest/view_show.html.erb
|
47
|
+
- examples/merb-rest/controller.rb
|
48
|
+
- examples/merb-rest/view_edit.html.erb
|
49
|
+
- examples/merb-rest/model.rb
|
50
|
+
- examples/auto_shop.rb
|
51
|
+
- examples/TrafficLight_state.png
|
52
|
+
- lib/state_machine.rb
|
53
|
+
- lib/tasks/state_machine.rake
|
54
|
+
- lib/tasks/state_machine.rb
|
55
|
+
- lib/state_machine/transition.rb
|
56
|
+
- lib/state_machine/initializers/rails.rb
|
57
|
+
- lib/state_machine/initializers/merb.rb
|
58
|
+
- lib/state_machine/condition_proxy.rb
|
59
|
+
- lib/state_machine/matcher.rb
|
60
|
+
- lib/state_machine/state.rb
|
61
|
+
- lib/state_machine/assertions.rb
|
62
|
+
- lib/state_machine/integrations.rb
|
63
|
+
- lib/state_machine/eval_helpers.rb
|
64
|
+
- lib/state_machine/event_collection.rb
|
65
|
+
- lib/state_machine/matcher_helpers.rb
|
66
|
+
- lib/state_machine/guard.rb
|
67
|
+
- lib/state_machine/event.rb
|
68
|
+
- lib/state_machine/callback.rb
|
69
|
+
- lib/state_machine/machine_collection.rb
|
70
|
+
- lib/state_machine/machine.rb
|
71
|
+
- lib/state_machine/transition_collection.rb
|
72
|
+
- lib/state_machine/integrations/active_model.rb
|
73
|
+
- lib/state_machine/integrations/mongo_mapper.rb
|
74
|
+
- lib/state_machine/integrations/data_mapper.rb
|
75
|
+
- lib/state_machine/integrations/active_record.rb
|
76
|
+
- lib/state_machine/integrations/sequel.rb
|
77
|
+
- lib/state_machine/integrations/active_record/locale.rb
|
78
|
+
- lib/state_machine/integrations/data_mapper/observer.rb
|
79
|
+
- lib/state_machine/integrations/active_model/locale.rb
|
80
|
+
- lib/state_machine/integrations/active_model/observer.rb
|
81
|
+
- lib/state_machine/state_collection.rb
|
82
|
+
- lib/state_machine/node_collection.rb
|
83
|
+
- lib/state_machine/extensions.rb
|
84
|
+
- lib/state_machine/initializers.rb
|
85
|
+
- test/files/en.yml
|
86
|
+
- test/files/switch.rb
|
87
|
+
- test/unit/callback_test.rb
|
88
|
+
- test/unit/transition_test.rb
|
89
|
+
- test/unit/machine_test.rb
|
90
|
+
- test/unit/event_test.rb
|
91
|
+
- test/unit/event_collection_test.rb
|
92
|
+
- test/unit/invalid_transition_test.rb
|
93
|
+
- test/unit/state_collection_test.rb
|
94
|
+
- test/unit/invalid_event_test.rb
|
95
|
+
- test/unit/assertions_test.rb
|
96
|
+
- test/unit/integrations_test.rb
|
97
|
+
- test/unit/transition_collection_test.rb
|
98
|
+
- test/unit/guard_test.rb
|
99
|
+
- test/unit/eval_helpers_test.rb
|
100
|
+
- test/unit/integrations/mongo_mapper_test.rb
|
101
|
+
- test/unit/integrations/data_mapper_test.rb
|
102
|
+
- test/unit/integrations/sequel_test.rb
|
103
|
+
- test/unit/integrations/active_model_test.rb
|
104
|
+
- test/unit/integrations/active_record_test.rb
|
105
|
+
- test/unit/matcher_test.rb
|
106
|
+
- test/unit/node_collection_test.rb
|
107
|
+
- test/unit/matcher_helpers_test.rb
|
108
|
+
- test/unit/state_test.rb
|
109
|
+
- test/unit/machine_collection_test.rb
|
110
|
+
- test/unit/state_machine_test.rb
|
111
|
+
- test/unit/condition_proxy_test.rb
|
112
|
+
- test/functional/state_machine_test.rb
|
113
|
+
- test/test_helper.rb
|
114
|
+
- CHANGELOG.rdoc
|
115
|
+
- init.rb
|
116
|
+
- LICENSE
|
117
|
+
- Rakefile
|
118
|
+
- README.rdoc
|
118
119
|
has_rdoc: true
|
119
120
|
homepage: http://www.pluginaweek.org
|
120
121
|
licenses: []
|
@@ -123,23 +124,25 @@ post_install_message:
|
|
123
124
|
rdoc_options: []
|
124
125
|
|
125
126
|
require_paths:
|
126
|
-
|
127
|
+
- lib
|
127
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
129
|
none: false
|
129
130
|
requirements:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 3
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
version: "0"
|
135
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
138
|
none: false
|
137
139
|
requirements:
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
hash: 3
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
version: "0"
|
143
146
|
requirements: []
|
144
147
|
|
145
148
|
rubyforge_project: pluginaweek
|
@@ -148,29 +151,29 @@ signing_key:
|
|
148
151
|
specification_version: 3
|
149
152
|
summary: Adds support for creating state machines for attributes on any Ruby class
|
150
153
|
test_files:
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
154
|
+
- test/unit/callback_test.rb
|
155
|
+
- test/unit/transition_test.rb
|
156
|
+
- test/unit/machine_test.rb
|
157
|
+
- test/unit/event_test.rb
|
158
|
+
- test/unit/event_collection_test.rb
|
159
|
+
- test/unit/invalid_transition_test.rb
|
160
|
+
- test/unit/state_collection_test.rb
|
161
|
+
- test/unit/invalid_event_test.rb
|
162
|
+
- test/unit/assertions_test.rb
|
163
|
+
- test/unit/integrations_test.rb
|
164
|
+
- test/unit/transition_collection_test.rb
|
165
|
+
- test/unit/guard_test.rb
|
166
|
+
- test/unit/eval_helpers_test.rb
|
167
|
+
- test/unit/integrations/mongo_mapper_test.rb
|
168
|
+
- test/unit/integrations/data_mapper_test.rb
|
169
|
+
- test/unit/integrations/sequel_test.rb
|
170
|
+
- test/unit/integrations/active_model_test.rb
|
171
|
+
- test/unit/integrations/active_record_test.rb
|
172
|
+
- test/unit/matcher_test.rb
|
173
|
+
- test/unit/node_collection_test.rb
|
174
|
+
- test/unit/matcher_helpers_test.rb
|
175
|
+
- test/unit/state_test.rb
|
176
|
+
- test/unit/machine_collection_test.rb
|
177
|
+
- test/unit/state_machine_test.rb
|
178
|
+
- test/unit/condition_proxy_test.rb
|
179
|
+
- test/functional/state_machine_test.rb
|