dynamo_record 0.0.2 → 0.0.3

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: e2b3b1babf6816e8d053f2ed3727b3d9d3dcba35
4
- data.tar.gz: c01daad801de85f6ffd8aad7c86537f4ba8d6851
3
+ metadata.gz: 7f4b800863e658f88af3a6ea20bd0223e945daca
4
+ data.tar.gz: 12b65d2ea96d315e2fdd73772ed26065eba00ea2
5
5
  SHA512:
6
- metadata.gz: c605a5178abd0378fe20e435f7344c27167b155e0bb6fb214af6e311883ca5cd228b455dcd7a211536d38d1f2f94c6bde8dde4c750c6adaf33dca6e52f32167f
7
- data.tar.gz: 026eeb7d5f4ad6cada4d1d561dd0eb32022e71d74f150f590607f3e4804f7f771cd5b52bb8d47ba3f4a894f66f8df94ebd5fd1ce4e722f5a8a7173b530921763
6
+ metadata.gz: b77f201f8e17c176765069f55f4ae716d63442096bf1f38e81e6175d40c559ea79219cbcef2f4452120a4c9edf7a2a7a38ac798a78b1e73eddc8db8203d28fbc
7
+ data.tar.gz: b1387a034395a98388b9a8bf5713c0075ac28dfca2c127ec87219b8965e50a101a26f5fee39db19c9a566f252b2cf6abca5f57f5d61ce4deb4fcf9e2cc06047c
@@ -13,7 +13,7 @@ module DynamoRecord
13
13
  module ClassMethods
14
14
  def field(name, type = :string, opts = {})
15
15
  named = name.to_s
16
- self.attributes = attributes.merge(name: {type: type, options: opts})
16
+ self.attributes.merge!(name => {type: type, options: opts})
17
17
 
18
18
  define_method("#{named}=") { |value| write_attribute(named, value) }
19
19
  define_method("#{name}") { read_attribute(named) }
@@ -1,3 +1,3 @@
1
1
  module DynamoRecord
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -8,7 +8,15 @@ RSpec.describe DynamoRecord::Fields do
8
8
  end
9
9
 
10
10
  it 'accepts adding fields' do
11
- expect(Person.attributes).to eq({name: {type: :string, options: {}}})
11
+ class Employee
12
+ include DynamoRecord::Document
13
+
14
+ field :first_name, :string
15
+ field :last_name, :string
16
+ end
17
+ expect(Employee.attributes).to eq({id: {type: :string, options: {}},
18
+ first_name: {type: :string, options: {}},
19
+ last_name: {type: :string, options: {}}})
12
20
  end
13
21
 
14
22
  it 'accepts adding fields with index' do
@@ -18,7 +26,8 @@ RSpec.describe DynamoRecord::Fields do
18
26
  field :name, :string, index: true
19
27
  end
20
28
 
21
- expect(City.attributes).to eq({name: {type: :string, options: {index: true}}})
29
+ expect(City.attributes).to eq({id: {type: :string, options: {}},
30
+ name: {type: :string, options: {index: true}}})
22
31
  end
23
32
 
24
33
  it 'initializes with field values' do
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nguyen Vu Nguyen