From: Aaron Patterson Date: 2011-06-25T06:56:05+09:00 Subject: Re: Honoring #to_ary and such --AhhlLboLdkugWU4S Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 25, 2011 at 05:47:14AM +0900, Intransition wrote: > On Jun 24, 4:20=A0pm, Ryan Davis wrote: >=20 > > def foo=3D foo > > =A0 @foo =3D Array(foo) > > end >=20 > Ah, Sweet! Forgot about that. Be careful with strings. Array() may not do what you want depending on your target ruby: irb(main):001:0> RUBY_VERSION =3D> "1.9.2" irb(main):002:0> Array("hello\nworld").length =3D> 1 irb(main):003:0> >> RUBY_VERSION =3D> "1.8.7" >> Array("hello\nworld").length =3D> 2 >> Depending on your inputs, you may need to check for a String. --=20 Aaron Patterson http://tenderlovemaking.com/ --AhhlLboLdkugWU4S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJOBQftAAoJEJUxcLy0/6/GdlsH/jMMGO8/ufIm8ynvgKDh+Mms KncmNnOvyb3NP8N7gx9TnLVEJOrKyApo+JmoSvnVwfpCQw5Au3ZitnlbDZOUTFFR iqdFy3SXp41Dea8csCNNkMTri/Ik7lSha/z/YfnQpVSUa36cZIKLS6d0zWWCkP7w bSdDuB2675fWDlq+MbFaATeq3wigFD9TTNxkMcCD36HmqB+6XKI3zuwd9D9BDBIr JnxY31kJU9wOG+tQr1x2UZ5puSfAI3TN7/8XCoc8Ljbksl9fIlfb7MYJdmlPnhPL pW3D2mc+H3ZyfK5ANbGADAzVwcxF8XH5ywh5XyMXoIMaX60J+vvuq2Ju/OwDHzI= =NqZc -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S--