From: Joseph Jones Date: 2015-12-17T21:06:07-07:00 Subject: [ruby-core:72256] [Ruby trunk - Bug #11772] [Open] Implicit conversion of Array in String interpolation does not call to_str --5673862f_628c895d_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 4, 2015 at 22:22:= 39 MST, 6ftdan=40gmail.com wrote:Issue =2311772 has been reported by Dani= el P. Clark.----------------------------------------Bug =2311772: Implici= t conversion of Array in String interpolation does not call to=5Fstrhttps= ://bugs.ruby-lang.org/issues/11772* Author: Daniel P. Clark* Status: Open= * Priority: Normal* Assignee: * ruby -v: * Backport: 2.0.0: UNKNOWN, 2.1:= UNKNOWN, 2.2: UNKNOWN----------------------------------------While provi= ding an example in https://bugs.ruby-lang.org/issues/10930=23note-7 I fou= nd that the implicit changing of an Array calls to=5Fs without trying to=5F= str first. Isn't String interpolation =22implicitly=22 converting items t= o strings=3F=7E=7E=7Erubyclass Array def to=5Fstr =22Hello from Array=21=22= endend=22=23=7B=5B1,2,3,4,5=5D=7D=22=23 =3D> =5B1, 2, 3, 4, 5=5D=7E=7E=7E= I believe String interpolation should call =60to=5Fstr=60 before =60to=5F= s=60-- https://bugs.ruby-lang.org/ --5673862f_628c895d_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 4, 2015 at 22:22:39 MST, 6ftdan=40gmail.com wrote:
Issue =2311772 has been reported= by Daniel P. Clark.

----------------------------------------<= br />Bug =2311772: Implicit conversion of Array in String interpolation d= oes not call to=5Fstr
https://bugs.ruby-lang.org/issues/11772
<= br />* Author: Daniel P. Clark
* Status: Open
* Priority: Norma= l
* Assignee:
* ruby -v:
* Backport: 2.0.0: UNKNOWN, 2.1= : UNKNOWN, 2.2: UNKNOWN
----------------------------------------
While providing an example in https://bugs.ruby-lang.org/issues/10930=23= note-7 I found that the implicit changing of an Array calls to=5Fs withou= t trying to=5Fstr first. Isn't String interpolation =22implicitly=22 con= verting items to strings=3F

=7E=7E=7Eruby
class Array
def to=5Fstr
=22Hello from Array=21=22
end
end
=22=23=7B=5B1,2,3,4,5=5D=7D=22
=23 =3D> =5B1, 2, 3, 4, 5=5D=
=7E=7E=7E

I believe String interpolation should call =60= to=5Fstr=60 before =60to=5Fs=60



--
https://b= ugs.ruby-lang.org/
--5673862f_628c895d_16c--