finer_struct 0.0.6 → 0.0.7

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: 80dfaa74d9276f522ca1cf4e39175f42b8e679bc
4
- data.tar.gz: 78595752aa946668b311fced58235745a0d0025e
3
+ metadata.gz: efc9874761281c4def8fcadbb25882b1c80946d0
4
+ data.tar.gz: f2b19060bc14eb3af7c2b8d021c52f061245d141
5
5
  SHA512:
6
- metadata.gz: ef9af062326f3afb4bd18b9fd20eaea8472ef7062518eaf010a8616b0e9f77742c4bcc1f1a68e36e6cdd63940642371e403cac86f9b8aa79d950b3f3b2c861c4
7
- data.tar.gz: 1d8d5dbb7c2ffbb279e92dfe829d7c598ad3d878b259bbd8514ac8b973ed30095287c0e820fae5bc391f05855714461d14c9c27b270f42ace0301ad72212fb46
6
+ metadata.gz: c8d08f594eccc29b4ecd5a12caa9fc2c4501ca25ea2360988e059053617e554f3cc8650796b7c7ef596bab2f78ea2e6c28b5d51f08e9bdfdfa53e40678beaeb2
7
+ data.tar.gz: b7aaae5aae267c3499dba6a47e21a92794d29957db92bd47382dc435775d778bdcc5b55e5fec538387fd173e32c677fa111f6928089359296d935858b1bfbd5e
@@ -8,7 +8,8 @@ module FinerStruct
8
8
  raise(ArgumentError, "unknown attributes: #{unknown_attributes.join(', ')}")
9
9
  end
10
10
 
11
- super(attributes)
11
+ nil_attributes = Hash[attribute_names.zip()]
12
+ super(nil_attributes.merge!(attributes))
12
13
  end
13
14
 
14
15
  def self.build_class(superclass, attribute_names)
@@ -1,3 +1,3 @@
1
1
  module FinerStruct
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -26,4 +26,8 @@ shared_examples "a named struct" do
26
26
  it "complains if you set attributes that the struct doesn't have" do
27
27
  expect { klass.new(c: 3, d: 4) }.to raise_error(ArgumentError, "unknown attributes: c, d")
28
28
  end
29
+
30
+ it "returns nil for attributes that aren't explicitly set" do
31
+ expect(klass.new(a: 1).b).to be_nil
32
+ end
29
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finer_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Yandell