From a9824a3113ee5342e7ac90387de9f3b9d5ec9e0a Mon Sep 17 00:00:00 2001 From: Nick Kelley Date: Fri, 30 Apr 2021 15:12:34 -0700 Subject: [PATCH] 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 a36310209b..000e816781 100644 --- a/hash.c +++ b/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 *