has_versions 0.9.0 → 0.9.5
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/has_versions.gemspec +1 -1
- data/lib/has_versions/record/attributes.rb +2 -2
- data/lib/has_versions/version/diff.rb +1 -9
- data/test/support/test_model.rb +6 -0
- 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: ea752049fb06dc28b7a1870426655213251cd361
|
4
|
+
data.tar.gz: 6ae73a71b15133b48701b4830d23a0d05527c02a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d467415baff52c963806c5bdb73a511ace1220e754260aec25f0c45841fe1c3e299ede208e07dc5314ee79ef303b80ff2549a864f3771e164e5989b012e8f7be
|
7
|
+
data.tar.gz: f8df2c955b94c12391d18fc26201aaa852416a7c43834baf287480d9102d4392065174c1e2aac7e5ee118b64e0c02e82715a9d4c8c625d6217bb29131e03c445
|
data/has_versions.gemspec
CHANGED
@@ -30,7 +30,7 @@ module HasVersions
|
|
30
30
|
@decoded_snapshot ||= begin
|
31
31
|
decoded = {}
|
32
32
|
target.class.versioned_attributes.each do |attribute|
|
33
|
-
decoded[attribute] = decode_attribute(attribute, snapshot[attribute])
|
33
|
+
decoded[attribute] = target.versioning_decode_value(attribute, snapshot[attribute])#attribute.to_s#decode_attribute(attribute, snapshot[attribute])
|
34
34
|
end
|
35
35
|
decoded
|
36
36
|
end
|
@@ -38,14 +38,6 @@ module HasVersions
|
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
-
def decode_attribute(attribute, value)
|
42
|
-
value = target.versioning_decode_value(attribute, snapshot[attribute])
|
43
|
-
|
44
|
-
@dummy_target ||= target.class.new
|
45
|
-
@dummy_target.send("#{attribute}=", value)
|
46
|
-
@dummy_target.send(attribute).presence
|
47
|
-
end
|
48
|
-
|
49
41
|
def diff_fetch(other)
|
50
42
|
@diff_cache ||= {}
|
51
43
|
@diff_cache[other] ||= yield
|
data/test/support/test_model.rb
CHANGED
@@ -3,7 +3,9 @@ class TestRecord
|
|
3
3
|
self.version_class_name = 'TestVersion'
|
4
4
|
|
5
5
|
def initialize(attributes = {})
|
6
|
+
@attributes = {}
|
6
7
|
attributes.each do |key, value|
|
8
|
+
@attributes[key.to_s] = value
|
7
9
|
send("#{key}=", value)
|
8
10
|
end
|
9
11
|
end
|
@@ -19,4 +21,8 @@ class TestRecord
|
|
19
21
|
def versioning_codable?(name)
|
20
22
|
true
|
21
23
|
end
|
24
|
+
|
25
|
+
def [](attribute)
|
26
|
+
@attributes[attribute]
|
27
|
+
end
|
22
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_versions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Rodgers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|