can_has_state 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/can_has_state/definition.rb +1 -1
- data/lib/can_has_state/locale/en.yml +5 -0
- data/lib/can_has_state/machine.rb +4 -4
- data/lib/can_has_state/version.rb +1 -1
- data/lib/can_has_state.rb +3 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e804c70108bf79ff92ddf4bf482f935d250c22eb
|
4
|
+
data.tar.gz: 6a05c6e5bd695850d7f5afd410ebb4aba6af643d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21508ef4e8db6892c6802722c9f0fb7e4ce8e2dee73b180fc54ade9a2de35963b6a7d536078ddf5a50d9495ed9c80cd5a5e75f7d9b421a837cca9f98121a3692
|
7
|
+
data.tar.gz: e45b6771712c7b324f39a716845bfe6de7e7a11bb0777ef6032343b9d66ce8b01ffe400abd813282c05f47ee91c72ae179c7f0c7856a0601c4a1d7f8e3fd80e6
|
@@ -28,7 +28,7 @@ module CanHasState
|
|
28
28
|
|
29
29
|
# TODO: turn even guards into types of triggers ... then support :guard as a trigger param
|
30
30
|
guards = []
|
31
|
-
message =
|
31
|
+
message = :invalid_transition
|
32
32
|
# TODO: differentiate messages for :from errors vs. :guard errors
|
33
33
|
|
34
34
|
options.each do |key, val|
|
@@ -87,17 +87,17 @@ module CanHasState
|
|
87
87
|
from, to = send("#{column}_was"), send(column)
|
88
88
|
next if from == to
|
89
89
|
if !sm.known?(to)
|
90
|
-
err << [column,
|
90
|
+
err << [column, :invalid_state]
|
91
91
|
elsif !sm.allow?(self, to) #state_machine_allow?(column, to)
|
92
|
-
err << [column, sm.message(to)
|
92
|
+
err << [column, sm.message(to), {from: from, to: to}]
|
93
93
|
end
|
94
94
|
end
|
95
95
|
err
|
96
96
|
end
|
97
97
|
|
98
98
|
def can_has_valid_state_machines
|
99
|
-
can_has_state_errors.each do |(column, msg)|
|
100
|
-
errors.add column, msg
|
99
|
+
can_has_state_errors.each do |(column, msg, opts)|
|
100
|
+
errors.add column, msg, opts||{}
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
data/lib/can_has_state.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: can_has_state
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thomas morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/can_has_state.rb
|
94
94
|
- lib/can_has_state/definition.rb
|
95
95
|
- lib/can_has_state/dirty_helper.rb
|
96
|
+
- lib/can_has_state/locale/en.yml
|
96
97
|
- lib/can_has_state/machine.rb
|
97
98
|
- lib/can_has_state/railtie.rb
|
98
99
|
- lib/can_has_state/version.rb
|
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
119
|
version: '0'
|
119
120
|
requirements: []
|
120
121
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.6.
|
122
|
+
rubygems_version: 2.6.13
|
122
123
|
signing_key:
|
123
124
|
specification_version: 4
|
124
125
|
summary: Super simple state machine for ActiveModel
|