rails-workflow 1.4.15 → 1.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/rspec +5 -0
- data/lib/workflow/errors.rb +2 -3
- data/lib/workflow/state.rb +7 -1
- data/lib/workflow/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 583ee5eba2d338478a47f49f720fc041f503d0e9
|
4
|
+
data.tar.gz: d5a7b0285e181674f31d58f695cf495dd58f5dc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a3b067942dd1c66ff78269117b8f5e4cae1dc96d3946c9f8c06a2648ebcb00d10b811090bcf33101f0df13a92c8d6153defddee8b7f1177f918238e8e3a1c5b
|
7
|
+
data.tar.gz: dc71f92fd5a70ab7360ee6784914d24400f518105a5741f0c0a59d9b1cf1baa85154d6c2036c0dcb3b7b66906e104367ed1a840d63a87ae1f2b0951d33eeea64
|
data/bin/rspec
ADDED
data/lib/workflow/errors.rb
CHANGED
@@ -35,9 +35,8 @@ module Workflow
|
|
35
35
|
end
|
36
36
|
|
37
37
|
class StateComparisonError < StandardError
|
38
|
-
def initialize(state)
|
39
|
-
super("
|
40
|
-
I can only be compared with a Workflow::State.".squish)
|
38
|
+
def initialize(state, other)
|
39
|
+
super("Can't compare #{state} with #{other} bc [#{other}] is not a defined state.")
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
data/lib/workflow/state.rb
CHANGED
@@ -114,6 +114,10 @@ module Workflow
|
|
114
114
|
"<State name=#{name.inspect} events(#{events.length})=#{events.inspect}>"
|
115
115
|
end
|
116
116
|
|
117
|
+
def to_s
|
118
|
+
name.to_s
|
119
|
+
end
|
120
|
+
|
117
121
|
# Overloaded comparison operator. Workflow states are sorted according to the order
|
118
122
|
# in which they were defined.
|
119
123
|
#
|
@@ -121,7 +125,9 @@ module Workflow
|
|
121
125
|
# @return [Integer]
|
122
126
|
def <=>(other)
|
123
127
|
if other.is_a?(Symbol)
|
124
|
-
|
128
|
+
state = all_states.find { |s| s.name == other }
|
129
|
+
raise Errors::StateComparisonError.new(self, other) unless state
|
130
|
+
other = state
|
125
131
|
end
|
126
132
|
all_states.index(self) <=> all_states.index(other)
|
127
133
|
end
|
data/lib/workflow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Gannon
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- asdf
|
212
212
|
- bin/console
|
213
213
|
- bin/deploy
|
214
|
+
- bin/rspec
|
214
215
|
- bin/setup
|
215
216
|
- gemfiles/Gemfile.rails-3.x
|
216
217
|
- gemfiles/Gemfile.rails-4.0
|