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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27bbc91a2c9695f07af210889edbf3f443ba58ca
4
- data.tar.gz: 82c7aba991d82e9505e4588995b0cf18345914df
3
+ metadata.gz: ea752049fb06dc28b7a1870426655213251cd361
4
+ data.tar.gz: 6ae73a71b15133b48701b4830d23a0d05527c02a
5
5
  SHA512:
6
- metadata.gz: a451cb20e408f91b2caf65443bd25070f9f0476af8bfd2b09b010635b4d01b84d65fdc6fabf8c622117af3e6c8d823c6b782402d8d8c1fa25cbb47a20c98f582
7
- data.tar.gz: 32bc445bed46d872fd160adc5672ea3d31e526bab1c394ed5f8602506cbfa9b257e0349c7923f302c05b5bf4c9ba35c3b203e535bf472dd401218a8772c1cdc6
6
+ metadata.gz: d467415baff52c963806c5bdb73a511ace1220e754260aec25f0c45841fe1c3e299ede208e07dc5314ee79ef303b80ff2549a864f3771e164e5989b012e8f7be
7
+ data.tar.gz: f8df2c955b94c12391d18fc26201aaa852416a7c43834baf287480d9102d4392065174c1e2aac7e5ee118b64e0c02e82715a9d4c8c625d6217bb29131e03c445
data/has_versions.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "has_versions"
4
- s.version = '0.9.0'
4
+ s.version = '0.9.5'
5
5
 
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Grant Rodgers"]
@@ -11,7 +11,7 @@ module HasVersions
11
11
 
12
12
  def versioned_attributes
13
13
  create_versioned_attributes do |attribute|
14
- send(attribute)
14
+ self[attribute]
15
15
  end
16
16
  end
17
17
 
@@ -32,4 +32,4 @@ module HasVersions
32
32
  end
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -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
@@ -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.0
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-29 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport