Issue #11776 has been updated by Yukihiro Matsumoto.


Confirmed. ;-)

Matz.


----------------------------------------
Bug #11776: dig and custom objects
https://bugs.ruby-lang.org/issues/11776#change-55272

* 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/