From: Joseph Jones Date: 2015-12-17T21:06:08-07:00 Subject: [ruby-core:72257] [Ruby trunk - Bug #11776] [Open] dig and custom objects --56738630_721da317_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 5, 2015 at 22:18:= 03 MST, ruby-core=40marc-andre.ca wrote:Issue =2311776 has been reported = by Marc-Andre Lafortune.----------------------------------------Bug =2311= 776: dig and custom objectshttps://bugs.ruby-lang.org/issues/11776* Autho= r: Marc-Andre Lafortune* Status: Open* Priority: Normal* Assignee: Yukihi= ro Matsumoto* ruby -v: 2.3.0 preview* Backport: 2.0.0: UNKNOWN, 2.1: UNKN= OWN, 2.2: UNKNOWN----------------------------------------Although current= ly undocumented and untested, it is possible to =60dig=60 objects of any = class that implements =60dig=60: class =46oo def dig(x, *) 40 + x end end= =7Bhello: =46oo.new=7D.dig(:hello, 2) =23 =3D> 42This seems actually qui= te nice to me.Matz, could you confirm that this is part of the new featur= e=3F I'll fix the documentation and add some basic tests-- https://bugs.r= uby-lang.org/ --56738630_721da317_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 5, 2015 at 22:18:03 MST, ruby-core=40marc-andre.ca wrote:
Issue =2311776 has been r= eported by Marc-Andre Lafortune.

-----------------------------= -----------
Bug =2311776: dig and custom objects
https://bugs.r= uby-lang.org/issues/11776

* Author: Marc-Andre Lafortune
= * Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumot= o
* ruby -v: 2.3.0 preview
* Backport: 2.0.0: UNKNOWN, 2.1: UNK= NOWN, 2.2: UNKNOWN
----------------------------------------
Alt= hough currently undocumented and untested, it is possible to =60dig=60 ob= jects of any class that implements =60dig=60:

class =46oo<= br /> def dig(x, *)
40 + x
end
end<= br />
=7Bhello: =46oo.new=7D.dig(:hello, 2) =23 =3D> 42
This seems actually quite nice to me.

Matz, could you confi= rm that this is part of the new feature=3F I'll fix the documentation and= add some basic tests




--
https://bugs.= ruby-lang.org/
--56738630_721da317_16c--