transitionable 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/transitionable.rb +3 -2
- data/lib/transitionable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17b36313626fb63024ebe0c211a7270420e179c9
|
4
|
+
data.tar.gz: 264abb2c7db835c96963665f3df3507d2557b8e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d58b580082136207cdb9fccc9eb98862ed020c86bef51236c8fd646a96125d9df2ad83047ea1be9ad57dd3123173823ece4a68ed86524579b1db3b10a4490f10
|
7
|
+
data.tar.gz: e5d4ff7ea42f13d4c8a367936045ad1f3b60122e3043ed0a33c1f7b592e8b6927b30f3177e1ad2be7bf19c73998c402ea19e38109d0896846ab046729b5cc469
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
transitionable (0.3.
|
4
|
+
transitionable (0.3.1)
|
5
5
|
activesupport (~> 5.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
minitest (~> 5.1)
|
14
14
|
tzinfo (~> 1.1)
|
15
15
|
coderay (1.1.2)
|
16
|
-
concurrent-ruby (1.
|
16
|
+
concurrent-ruby (1.1.3)
|
17
17
|
diff-lcs (1.3)
|
18
18
|
i18n (1.1.1)
|
19
19
|
concurrent-ruby (~> 1.0)
|
data/lib/transitionable.rb
CHANGED
@@ -23,8 +23,9 @@ module Transitionable
|
|
23
23
|
self.state_machines ||= {}
|
24
24
|
self.state_machines[name] = { states: states.values, transitions: transitions }
|
25
25
|
self.state_machines[name][:states].each do |this_state|
|
26
|
-
|
27
|
-
|
26
|
+
method_name = "#{this_state}?".to_sym
|
27
|
+
raise 'Method already defined' if self.instance_methods(false).include?(method_name)
|
28
|
+
define_method method_name do
|
28
29
|
current_state_based_on(this_state) == this_state
|
29
30
|
end
|
30
31
|
end
|