dynamo_record 0.0.13 → 0.0.14

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: 175ef0c5bc93ee3c4931cc3fe09b93fce238fb68
4
- data.tar.gz: 14195e2cc9c545cf441c275a037a2cd5b8fd1796
3
+ metadata.gz: fdc77988251b96b7ff26fe7b64c795030a25535d
4
+ data.tar.gz: a1d350928ed4043313511a43138fb455202be0ca
5
5
  SHA512:
6
- metadata.gz: fb015bce411ca4009e53c0f1a107cf8adeb92a385a0c619114f94d29e3be03ae2c5f4ecd797491631bd09bbdb233cb86db754fae31afd0a31911d89f6467904e
7
- data.tar.gz: 80a062be38333b404aa6dd62188992d848097292714e6f51c58801e00d58818a1c1a2f3f0e91923807ba100ffe410e78819587041c3e22c62f8caa9465878d07
6
+ metadata.gz: 8bc834611cf2826a3adb31404bb0f3acfab75de05a169d4d6ff72974797332f113cdf56019b3ffd6225d262445b0da51ef9de4f2d5f31477c96488fbea26e565
7
+ data.tar.gz: 74ffa1efc05cdd8268e8b6c1f2004f34e809198cdcb9b80b790956e3ba7a8dc2bc9a72af7e5e905595b89713fdb8b090d822dece8bd73f4f3b8d8a88abd12107
@@ -36,7 +36,7 @@ module DynamoRecord
36
36
  def load(attrs, ignore_unknown_field=false)
37
37
  attrs.each do |key, value|
38
38
  next if ignore_unknown_field && !respond_to?("#{key}=")
39
- send("#{key}=", self.class.undump_field(value, self.class.attributes[key.to_sym]))
39
+ send("#{key}=", value)
40
40
  end
41
41
  end
42
42
 
@@ -72,7 +72,7 @@ module DynamoRecord
72
72
  end
73
73
 
74
74
  def write_attribute(name, value)
75
- attributes[name.to_sym] = value
75
+ attributes[name.to_sym] = self.class.undump_field(value, self.class.attributes[name.to_sym])
76
76
  end
77
77
 
78
78
  def read_attribute(name)
@@ -1,3 +1,3 @@
1
1
  module DynamoRecord
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -45,7 +45,7 @@ RSpec.describe DynamoRecord::Fields do
45
45
  expect(person.name).to eq('A person')
46
46
  end
47
47
 
48
- it 'coearce field to its data type' do
48
+ it 'coearce field to its data type when intializing' do
49
49
  class Record
50
50
  include DynamoRecord::Document
51
51
 
@@ -61,6 +61,12 @@ RSpec.describe DynamoRecord::Fields do
61
61
  expect(Record.new(boolean_field: 'true').boolean_field).to be_truthy
62
62
  end
63
63
 
64
+ it 'coearce field to its data type when calling writer' do
65
+ person = Person.new
66
+ person.created_at = '2015-01-23T04:27:21Z'
67
+ expect(person.created_at).to eq(DateTime.parse('2015-01-23T04:27:21Z'))
68
+ end
69
+
64
70
  describe 'predicate method' do
65
71
  specify { expect(Person.new(activated: false).activated?).to be_falsy }
66
72
  specify { expect(Person.new(activated: true).activated?).to be_truthy }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamo_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nguyen Vu Nguyen