mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Correct documentation example on Hash#dig
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}
This commit is contained in:
parent
1f255adda9
commit
a9824a3113
Notes:
git
2021-05-01 07:46:46 +09:00
1 changed files with 1 additions and 1 deletions
2
hash.c
2
hash.c
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue