stator 0.1.5 → 0.1.6
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/lib/stator/integration.rb +5 -13
- data/lib/stator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c51bab4f9cfa7e0c8fbaac47da18143898daeb76
|
|
4
|
+
data.tar.gz: d542029f7c61d7e4b048cca25b4b069fe9e6675d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f1c077b6c700ec18e6004145b8f6a7bbb29dcf71a548b4140faefadbd3ba846110ed30c57babc0fc7a53c1930c680d4170b6ada1f3620a3944d8ef3e683173aa
|
|
7
|
+
data.tar.gz: 27547c0eb04dd4e3436aa743d03ab48c0fc4ea7dc41c01c9b4862c1c8d4190b718db17f8c90f14a938260bbcbcf04fa606d477e8e33b74330d16c75da0ee07e6
|
data/lib/stator/integration.rb
CHANGED
|
@@ -124,28 +124,20 @@ module Stator
|
|
|
124
124
|
|
|
125
125
|
def attempt_to_track_state(state_to_track)
|
|
126
126
|
return unless state_to_track
|
|
127
|
-
|
|
128
|
-
field_name = "#{state_to_track}_#{@machine.field}_at"
|
|
129
|
-
|
|
130
|
-
return unless @record.respond_to?(field_name)
|
|
131
|
-
return unless @record.respond_to?("#{field_name}=")
|
|
132
|
-
|
|
133
|
-
unless @record.send(field_name)
|
|
134
|
-
@record.send("#{field_name}=", (Time.zone || Time).now)
|
|
135
|
-
end
|
|
127
|
+
_attempt_to_track_change("#{state_to_track}_#{@machine.field}_at")
|
|
136
128
|
end
|
|
137
129
|
|
|
138
130
|
def attempt_to_track_state_changed_timestamp
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
field_name = "#{@machine.field}_changed_at"
|
|
131
|
+
_attempt_to_track_change("#{@machine.field}_changed_at")
|
|
132
|
+
end
|
|
142
133
|
|
|
134
|
+
def _attempt_to_track_change(field_name)
|
|
143
135
|
return unless @record.respond_to?(field_name)
|
|
144
136
|
return unless @record.respond_to?("#{field_name}=")
|
|
137
|
+
return unless @record.send("#{field_name}").nil? || self.state_changed?
|
|
145
138
|
|
|
146
139
|
@record.send("#{field_name}=", (Time.zone || Time).now)
|
|
147
140
|
end
|
|
148
141
|
|
|
149
|
-
|
|
150
142
|
end
|
|
151
143
|
end
|
data/lib/stator/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Nelson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|