Skip to content

Commit

Permalink
Correct documentation example on Hash#dig
Browse files Browse the repository at this point in the history
Fixes [Misc #17842]. The current documentation suggests that:

        {foo: {bar: {baz: 2}}}.dig(:foo, :bar) # => {:bar=>{:baz=>2}}

when it should be:

        {foo: {bar: {baz: 2}}}.dig(:foo, :bar) # => {:baz=>2}
  • Loading branch information
nickkelley42 authored and jeremyevans committed Apr 30, 2021
1 parent 1f255ad commit a9824a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hash.c
Expand Up @@ -4555,7 +4555,7 @@ rb_hash_any_p(int argc, VALUE *argv, VALUE hash)
* Nested Hashes:
* h = {foo: {bar: {baz: 2}}}
* h.dig(:foo) # => {:bar=>{:baz=>2}}
* h.dig(:foo, :bar) # => {:bar=>{:baz=>2}}
* h.dig(:foo, :bar) # => {:baz=>2}
* h.dig(:foo, :bar, :baz) # => 2
* h.dig(:foo, :bar, :BAZ) # => nil
*
Expand Down

0 comments on commit a9824a3

Please sign in to comment.