From: eregontp@... Date: 2015-12-06T11:53:12+00:00 Subject: [ruby-core:71856] [Ruby trunk - Bug #11776] dig and custom objects Issue #11776 has been updated by Benoit Daloze. There is already a spec for this behavior though :) https://github.com/ruby/rubyspec/blob/master/core/hash/dig_spec.rb ---------------------------------------- Bug #11776: dig and custom objects https://bugs.ruby-lang.org/issues/11776#change-55259 * Author: Marc-Andre Lafortune * Status: Open * Priority: Normal * Assignee: Yukihiro Matsumoto * ruby -v: 2.3.0 preview * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Although currently undocumented and untested, it is possible to `dig` objects of any class that implements `dig`: class Foo def dig(x, *) 40 + x end end {hello: Foo.new}.dig(:hello, 2) # => 42 This seems actually quite nice to me. Matz, could you confirm that this is part of the new feature? I'll fix the documentation and add some basic tests -- https://bugs.ruby-lang.org/