Actions
Misc #17842
closedExample incorrect in documentation for Hash#dig
Status:
Closed
Assignee:
Description
In the current examples for Hash#dig, we have:
h = {foo: {bar: {baz: 2}}}
h.dig(:foo) # => {:bar=>{:baz=>2}}
h.dig(:foo, :bar) # => {:bar=>{:baz=>2}} <-- incorrect return value
This should be:
h = {foo: {bar: {baz: 2}}}
h.dig(:foo) # => {:bar=>{:baz=>2}}
h.dig(:foo, :bar) # => {:baz=>2}
I have a pull request incoming to fix this on GitHub, but I can create a patch and post it here if that is better.
Documentation link for reference: https://ruby-doc.org/core-3.0.1/Hash.html#method-i-dig
Actions
Like0
Like0Like0Like0