stator 0.2.0 → 0.2.1
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 +5 -5
- data/.ruby-version +1 -1
- data/lib/stator/integration.rb +0 -8
- data/lib/stator/model.rb +1 -2
- data/lib/stator/version.rb +1 -1
- data/spec/model_spec.rb +3 -1
- data/spec/support/models.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b05270b7332e9e7a783e90c7c88436fd54ae7056
|
4
|
+
data.tar.gz: bfe49f8f6174be19b87b1f94e8986050474509e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d39f7b87b6a727b42d9dcdf5d28afdd0cfd9978dece9817f4f5f7614e632b076048e9fad28d42cbeb2fc9c7af5a2cbd7c5983ce311510e10b1a2751b89faf3ce
|
7
|
+
data.tar.gz: e3ab4eb10476ab50529ea7e24a4c5e0c9598edc97b7df61a57ebe3c7ac4420d7ef1e2f2a0a9be5755d392a062d357adda44b7881d19bf720af67e66e4d3338d9
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.3
|
data/lib/stator/integration.rb
CHANGED
@@ -10,9 +10,6 @@ module Stator
|
|
10
10
|
@record = record
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
13
|
def state=(new_value)
|
17
14
|
@record.send("#{@machine.field}=", new_value)
|
18
15
|
end
|
@@ -21,7 +18,6 @@ module Stator
|
|
21
18
|
@record.send(@machine.field)
|
22
19
|
end
|
23
20
|
|
24
|
-
|
25
21
|
def state_was(use_previous = false)
|
26
22
|
if use_previous
|
27
23
|
@record.previous_changes[@machine.field.to_s].try(:[], 0)
|
@@ -30,7 +26,6 @@ module Stator
|
|
30
26
|
end
|
31
27
|
end
|
32
28
|
|
33
|
-
|
34
29
|
def state_changed?(use_previous = false)
|
35
30
|
if use_previous
|
36
31
|
!!@record.previous_changes[@machine.field.to_s]
|
@@ -39,8 +34,6 @@ module Stator
|
|
39
34
|
end
|
40
35
|
end
|
41
36
|
|
42
|
-
|
43
|
-
|
44
37
|
def validate_transition
|
45
38
|
return unless self.state_changed?
|
46
39
|
return if @machine.skip_validations
|
@@ -121,7 +114,6 @@ module Stator
|
|
121
114
|
@machine.states.reverse.detect{|s| in_state_at?(s,t) }
|
122
115
|
end
|
123
116
|
|
124
|
-
|
125
117
|
protected
|
126
118
|
|
127
119
|
def attempt_to_track_state(state_to_track)
|
data/lib/stator/model.rb
CHANGED
@@ -35,7 +35,7 @@ module Stator
|
|
35
35
|
|
36
36
|
def self.included(base)
|
37
37
|
base.class_eval do
|
38
|
-
|
38
|
+
before_save :_stator_track_transition, prepend: true
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -53,7 +53,6 @@ module Stator
|
|
53
53
|
|
54
54
|
|
55
55
|
def _stator_track_transition
|
56
|
-
|
57
56
|
self._stators.each do |namespace, machine|
|
58
57
|
machine.integration(self).track_transition
|
59
58
|
end
|
data/lib/stator/version.rb
CHANGED
data/spec/model_spec.rb
CHANGED
@@ -221,8 +221,10 @@ describe Stator::Model do
|
|
221
221
|
|
222
222
|
it 'should prepend the setting of the timestamp so other callbacks can use it' do
|
223
223
|
u = User.new
|
224
|
+
u.email = 'doug@example.com'
|
225
|
+
|
224
226
|
u.tagged_at.should be_nil
|
225
|
-
u.semiactivate
|
227
|
+
u.semiactivate!
|
226
228
|
|
227
229
|
u.semiactivated_state_at.should_not be_nil
|
228
230
|
u.tagged_at.should_not be_nil
|
data/spec/support/models.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stator
|
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
|
- Mike Nelson
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.4.5.1
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: The simplest of ActiveRecord state machines
|