unobtainium 0.3.2 → 0.3.3

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: b12bef553352e0f1788bb6fe9839c977e74bd820
4
- data.tar.gz: ad8dc22a879bf1318cd741b51b18c1b70360956b
3
+ metadata.gz: 0e112a3d91217d71a4550b176c685c73f0f110ce
4
+ data.tar.gz: 15203bf4fe2029dfd4caffa8297dda3ca45f3ef5
5
5
  SHA512:
6
- metadata.gz: ef9a855a31611512176889884aa02f306ba731eb7da271369d0d5281be4789c873cf1681e6c4f1ccde4f7aa7f3c5d3df141018e9b55cb90dbaa6b6964f9b199e
7
- data.tar.gz: f4d3c1ee2160e5faafc8d9b001bfa01571611a6c9ec37fb24745fe3dfc23df5f1ca38ed30f3d519345250cbda4d0c48e50d98ff2d50b938dbdc684cb8d10df72
6
+ metadata.gz: 6136aef43435b04c188977f12f693c8478d1c64de28c46dc33a661e81006fe0e97f1bc536ddbe506c0e6d86db9b3c8aab52370d288c7ad107643a0d17291e2e1
7
+ data.tar.gz: 72a1d82a85bba5e639e5a440704dc464b1914ddcdab8708920643fe981f4ae618ec8e3d3e6aee68e8f8e7837583fe9603005d9cd5ff8faa5422a66de723d05dc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unobtainium (0.3.2)
4
+ unobtainium (0.3.3)
5
5
  sys-proctable (~> 1.0)
6
6
 
7
7
  GEM
@@ -122,6 +122,9 @@ module Unobtainium
122
122
  if leaf.is_a? Hash
123
123
  leaf.default_proc = DEFAULT_PROC
124
124
  end
125
+ if leaf.nil?
126
+ leaf = @data
127
+ end
125
128
 
126
129
  # If we have a leaf, we want to send the requested method to that
127
130
  # leaf.
@@ -8,5 +8,5 @@
8
8
  #
9
9
  module Unobtainium
10
10
  # The current release version
11
- VERSION = "0.3.2".freeze
11
+ VERSION = "0.3.3".freeze
12
12
  end
@@ -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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unobtainium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Finkhaeuser