stateful_enum 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e93fa3aad64f0c66c8d1e5a14993b0176c269274
|
4
|
+
data.tar.gz: 0712a38f75019a9ee82e8a121e8d6d509aa208f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f54ad2ee66dc272f0f0c6594c847b5df6e70deb7f6e851e570f8442a1e8ae9c7301a512389c3fec15f188fe3fb26f73e971029d004f83d9b1489e8ab8899debc
|
7
|
+
data.tar.gz: c734c80ccf99dd5c077f643c9769369b1937fc7a8141fb48db674cae5d5e149b53fb618c4cd1db088aecf1bf92743a7a45f51e7d02ed805647bc41f93354a094
|
@@ -12,7 +12,8 @@ module StatefulEnum
|
|
12
12
|
|
13
13
|
if block
|
14
14
|
definitions.each_key do |column|
|
15
|
-
|
15
|
+
states = enum[column]
|
16
|
+
StatefulEnum::Machine.new self, column, (states.is_a?(Hash) ? states.keys : states), &block
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -4,7 +4,7 @@ module StatefulEnum
|
|
4
4
|
@model, @column, @states, @event_names = model, column, states, []
|
5
5
|
|
6
6
|
# undef non-verb methods e.g. Model#active!
|
7
|
-
states.
|
7
|
+
states.each do |state|
|
8
8
|
@model.send :undef_method, "#{state}!"
|
9
9
|
end
|
10
10
|
|
@@ -65,16 +65,16 @@ module StatefulEnum
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
transitions.each_pair do |from, to|
|
68
|
-
raise "Undefined state #{to}" unless @states.
|
68
|
+
raise "Undefined state #{to}" unless @states.include? to
|
69
69
|
Array(from).each do |f|
|
70
|
-
raise "Undefined state #{f}" unless @states.
|
70
|
+
raise "Undefined state #{f}" unless @states.include? f
|
71
71
|
@transitions[f] = [to, options[:if]]
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
def all
|
77
|
-
@states
|
77
|
+
@states
|
78
78
|
end
|
79
79
|
|
80
80
|
def before(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stateful_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|