README.md in dense-1.1.0 vs README.md in dense-1.1.1
- old
+ new
@@ -115,19 +115,19 @@
When it doesn't find, it raises an instance of `KeyError`:
```ruby
Dense.fetch({}, 'a.0.b')
# raises
- # KeyError: Found nothing at "a" ("0.b" remains)
+ # KeyError: found nothing at "a" ("0.b" remains)
```
It might instead raise an instance of `TypeError` if a non-integer key is requested of an array:
```ruby
Dense.fetch({ 'a' => [] }, 'a.k.b')
# raises
- # TypeError: No key "k" for Array at "a"
+ # TypeError: no key "k" for Array at "a"
```
See KeyError and TypeError below for more details.
`Dense.fetch(collection, path)` raises when it doesn't find, while `Dense.get(collection, path)` returns `nil`.
@@ -205,21 +205,21 @@
c # => { 'h' => { 'a' => [ 1, 2, 'three' ] } }
r # => 'three'
c = { 'a' => [] }
Dense.set(c, 'a.b', 1)
- # => TypeError: No key "b" for Array at "a"
+ # => TypeError: no key "b" for Array at "a"
c = { 'a' => {} }
r = Dense.set(c, 'a.1', 1)
c # => { 'a' => { '1' => 1 } }
r # => 1
c = {}
Dense.set(c, 'a.0', 1)
- # => KeyError: Found nothing at "a" ("0" remains)
+ # => KeyError: found nothing at "a" ("0" remains)
```
Setting at multiple places in one go is possible:
```ruby
c = { 'h' => {} }
@@ -280,15 +280,15 @@
```
It fails with a `KeyError` or a `TypeError` if it cannot unset.
```ruby
Dense.unset({}, 'a')
- # => KeyError: Found nothing at "a"
+ # => KeyError: found nothing at "a"
Dense.unset([], 'a')
- # => TypeError: No key "a" for Array at root
+ # => TypeError: no key "a" for Array at root
Dense.unset([], '1')
- # => KeyError: Found nothing at "1"
+ # => KeyError: found nothing at "1"
```
Unsetting multiple values is OK:
```ruby
@@ -307,10 +307,10 @@
begin
Dense.fetch({}, 'a.b')
rescue => err
err
end
- # => #<KeyError: Found nothing at "a" ("b" remains)>
+ # => #<KeyError: found nothing at "a" ("b" remains)>
e.full_path
# => "a"
e.miss
# => [false, [], {}, "a", [ "b" ]]
```