ruby-changes:66024
From: Nick <ko1@a...>
Date: Sat, 1 May 2021 07:46:32 +0900 (JST)
Subject: [ruby-changes:66024] a9824a3113 (master): Correct documentation example on Hash#dig
https://git.ruby-lang.org/ruby.git/commit/?id=a9824a3113 From a9824a3113ee5342e7ac90387de9f3b9d5ec9e0a Mon Sep 17 00:00:00 2001 From: Nick Kelley <nick@n...> Date: Fri, 30 Apr 2021 15:12:34 -0700 Subject: 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} --- hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash.c b/hash.c index a363102..000e816 100644 --- a/hash.c +++ b/hash.c @@ -4555,7 +4555,7 @@ rb_hash_any_p(int argc, VALUE *argv, VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L4555 * 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 * -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/