unobtainium 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/unobtainium/pathed_hash.rb +1 -1
- data/lib/unobtainium/version.rb +1 -1
- data/spec/pathed_hash_spec.rb +17 -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: d0256dcb12c516843f4cd830fc7f8d6e6fa18ee9
|
4
|
+
data.tar.gz: 1b1ff9e98627ca94e302a23e9fe88ac02962745d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 300c4af9f0ab8d9558a0d7bbb6a7915c9daba4ee419460df199465b129832931bb7189022bf98a747f2bca1494330233548f92a6a8db77baf13d265fa7cc5cca
|
7
|
+
data.tar.gz: d10fce97363e2777e1a1aad0e6dd31bbc7135b800685b2a43eda1f689be6b54bcfaa9cb9f7af6200e567b825b52015b26df5f9db68621aa7bf88efd30422e2a3
|
data/Gemfile.lock
CHANGED
@@ -188,7 +188,7 @@ module Unobtainium
|
|
188
188
|
|
189
189
|
# If we're a write function, then we need to create intermediary objects,
|
190
190
|
# i.e. what's at head if nothing is there.
|
191
|
-
if options[:create] and data
|
191
|
+
if options[:create] and data[head].nil?
|
192
192
|
data[head] = {}
|
193
193
|
end
|
194
194
|
|
data/lib/unobtainium/version.rb
CHANGED
data/spec/pathed_hash_spec.rb
CHANGED
@@ -172,4 +172,21 @@ describe ::Unobtainium::PathedHash do
|
|
172
172
|
expect(ph2["foo.bar"]).to eql 42
|
173
173
|
expect(ph2["foo.baz"]).to eql "quux"
|
174
174
|
end
|
175
|
+
|
176
|
+
it "can write with indifferent access without overwriting" do
|
177
|
+
sample = {
|
178
|
+
foo: {
|
179
|
+
bar: 42,
|
180
|
+
baz: 'quux',
|
181
|
+
}
|
182
|
+
}
|
183
|
+
ph = ::Unobtainium::PathedHash.new(sample)
|
184
|
+
|
185
|
+
expect(ph['foo.bar']).to eql 42
|
186
|
+
expect(ph['foo.baz']).to eql 'quux'
|
187
|
+
|
188
|
+
ph['foo.bar'] = 123
|
189
|
+
expect(ph['foo.bar']).to eql 123
|
190
|
+
expect(ph['foo.baz']).to eql 'quux'
|
191
|
+
end
|
175
192
|
end
|