attributed_object 0.3 → 0.3.1

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: 93bb8f83e8a3c78c45869a3b99dbe8daa9f2efb1
4
- data.tar.gz: 6bb5a36e47af0eccaea12e4c298bd410cb8d0270
3
+ metadata.gz: 22f705e863b9395e8f0b792f2f59d17f2312e27e
4
+ data.tar.gz: e1add90a18faa65ee4d999efce88fd6e63bf57fe
5
5
  SHA512:
6
- metadata.gz: 80b26de182c475a28339f7c2d3ac420fa1b36298d620118dc45cfcda8f981c49d1afbc39915cda76cafca16255cbbe3dc94c9f4e1ed8a40b853e428f37cdbc3a
7
- data.tar.gz: 6ac411f219a66a1c90d71964b86959399dfa5c2c06e84bca6a1122791596e3ec51a948f3a83c9407ffdaead18031199b0c8a4abf30fa5450ea68c771f73a912d
6
+ metadata.gz: cf49c1c8e060299308df7954879fcc64701bc61f6051164491b771080068a19ca6b2d985b952fa42217906f44c050e4b36aa9d42fd9a5dca35f8a9a63dd67135
7
+ data.tar.gz: afd7658ae6f341bbb2b7dbaf9bff5a60690716e6778b902ee745bd3df812083f57fc89fe36bea4c673fe70837869afc4cd7993f51d5a26323182f3a22d4a7ecb
@@ -1,3 +1,3 @@
1
1
  module AttributedObject
2
- VERSION = "0.3"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -15,7 +15,8 @@ module AttributedObjectHelpers
15
15
  end
16
16
 
17
17
  def self.slice(hash, keys)
18
- Hash[ [keys, hash.values_at(*keys)].transpose]
18
+ selected_keys = keys & hash.keys
19
+ Hash[ [selected_keys, hash.values_at(*selected_keys)].transpose]
19
20
  end
20
21
  end
21
22
  end
@@ -150,11 +150,12 @@ describe AttributedObject do
150
150
  class FooWithExtra
151
151
  include AttributedObject::Strict
152
152
  attributed_object ignore_extra_keys: true
153
- attribute :bar, :integer
153
+ attribute :bar, :integer, default: 42
154
154
  end
155
155
 
156
156
  expect { FooWithExtra.new(bar: 12, not_defined: 'asd') }.not_to raise_error
157
157
  expect(FooWithExtra.new(bar: 12, not_defined: 'asd').attributes).to eq(bar: 12)
158
+ expect(FooWithExtra.new( not_defined: 'asd').attributes).to eq(bar: 42)
158
159
  end
159
160
  end
160
161
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attributed_object
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaap Groeneveld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-26 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler