dynamo_record 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52df01e379863dd298b03b2d959d5fb413232042
4
- data.tar.gz: 3551424dafe92d4911befd4724a20419d6af8b95
3
+ metadata.gz: 175ef0c5bc93ee3c4931cc3fe09b93fce238fb68
4
+ data.tar.gz: 14195e2cc9c545cf441c275a037a2cd5b8fd1796
5
5
  SHA512:
6
- metadata.gz: dc3a850ae10daf4bc24b473f6c551ad15d0d3925355a93614f0d8f755f15ecd363ef2cedc9f85c5a6d7ee555b4b78b1de7b3fd07682156e9ced767fc4400c148
7
- data.tar.gz: 6be092762e7572e4a878649de003facbb40f2f3910c1a0bb1ba7140667fee8b8dab8b9bb687a21ddff04802a71fa89c09f1ae2e6074981ab10fc003d855b0307
6
+ metadata.gz: fb015bce411ca4009e53c0f1a107cf8adeb92a385a0c619114f94d29e3be03ae2c5f4ecd797491631bd09bbdb233cb86db754fae31afd0a31911d89f6467904e
7
+ data.tar.gz: 80a062be38333b404aa6dd62188992d848097292714e6f51c58801e00d58818a1c1a2f3f0e91923807ba100ffe410e78819587041c3e22c62f8caa9465878d07
@@ -19,7 +19,7 @@ module DynamoRecord
19
19
 
20
20
  end
21
21
 
22
- attr_accessor :new_record, :attributes
22
+ attr_accessor :new_record
23
23
 
24
24
  def initialize(attrs = {}, ignore_unknown_field = false)
25
25
  @new_record = true
@@ -39,5 +39,11 @@ module DynamoRecord
39
39
  send("#{key}=", self.class.undump_field(value, self.class.attributes[key.to_sym]))
40
40
  end
41
41
  end
42
+
43
+ def attributes=(hash)
44
+ hash.each do |k, v|
45
+ send("#{k}=", v)
46
+ end
47
+ end
42
48
  end
43
49
  end
@@ -3,7 +3,7 @@ module DynamoRecord
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- class_attribute :attributes
6
+ class_attribute :attributes, instance_writer: false
7
7
 
8
8
  self.attributes = {}
9
9
 
@@ -1,3 +1,3 @@
1
1
  module DynamoRecord
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -75,4 +75,13 @@ RSpec.describe DynamoRecord::Fields do
75
75
  expect(attrs[:created_at]).to eq(now.iso8601)
76
76
  end
77
77
  end
78
+
79
+ describe '#attributes=' do
80
+ it 'set attributes from hash' do
81
+ person = Person.new(name: 'A Person', activated: true)
82
+ person.attributes = {name: 'Updated Person'}
83
+ expect(person.name).to eq('Updated Person')
84
+ expect(person.activated).to eq(true)
85
+ end
86
+ end
78
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamo_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nguyen Vu Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport