unobtainium 0.3.2 → 0.3.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/unobtainium/pathed_hash.rb +3 -0
- data/lib/unobtainium/version.rb +1 -1
- data/spec/pathed_hash_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e112a3d91217d71a4550b176c685c73f0f110ce
|
|
4
|
+
data.tar.gz: 15203bf4fe2029dfd4caffa8297dda3ca45f3ef5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6136aef43435b04c188977f12f693c8478d1c64de28c46dc33a661e81006fe0e97f1bc536ddbe506c0e6d86db9b3c8aab52370d288c7ad107643a0d17291e2e1
|
|
7
|
+
data.tar.gz: 72a1d82a85bba5e639e5a440704dc464b1914ddcdab8708920643fe981f4ae618ec8e3d3e6aee68e8f8e7837583fe9603005d9cd5ff8faa5422a66de723d05dc
|
data/Gemfile.lock
CHANGED
data/lib/unobtainium/version.rb
CHANGED
data/spec/pathed_hash_spec.rb
CHANGED
|
@@ -34,6 +34,11 @@ describe ::Unobtainium::PathedHash do
|
|
|
34
34
|
expect(inverted.empty?).to eql false
|
|
35
35
|
expect(inverted[42]).to eql :foo
|
|
36
36
|
end
|
|
37
|
+
|
|
38
|
+
it "delegates to Hash if it's nothing to do with paths" do
|
|
39
|
+
ph = ::Unobtainium::PathedHash.new(foo: 42)
|
|
40
|
+
expect(ph.default).to be_nil
|
|
41
|
+
end
|
|
37
42
|
end
|
|
38
43
|
|
|
39
44
|
it "can recursively read entries via a path" do
|
|
@@ -54,6 +59,15 @@ describe ::Unobtainium::PathedHash do
|
|
|
54
59
|
expect(ph["bar.nope"]).to eql nil
|
|
55
60
|
end
|
|
56
61
|
|
|
62
|
+
it "behaves consistently if in a path the first node cannot be found" do
|
|
63
|
+
sample = {
|
|
64
|
+
"foo" => 42,
|
|
65
|
+
}
|
|
66
|
+
ph = ::Unobtainium::PathedHash.new(sample)
|
|
67
|
+
|
|
68
|
+
expect(ph["nope.bar"]).to eql nil
|
|
69
|
+
end
|
|
70
|
+
|
|
57
71
|
it "can be used with indifferent access from string key" do
|
|
58
72
|
sample = {
|
|
59
73
|
"foo" => 42,
|