--FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 20, 2012 at 01:47:24AM +0900, j.wuttke wrote: > From my understanding of the YAML spec, rule 138, > "[0,1,2]" should be a valid array; but under both > Ruby1.8 and Ruby1.9.3 it is parsed as [0]; to obtain > [0,1,2] I need to write "[0, 1, 2]". This appears to be a bug in Syck. If you install libyaml and recompile 1.9.3, your yaml back end should be Psych. Psych handles this case correctly. With trunk ruby (though 1.9.3 should work if you have libyaml installed): irb(main):001:0> RUBY_VERSION =3D> "2.0.0" irb(main):002:0> require 'yaml' =3D> true irb(main):003:0> YAML.load "[0,1,2]" =3D> [0, 1, 2] irb(main):004:0> With 1.8.7: >> RUBY_VERSION =3D> "1.8.7" >> require 'yaml' =3D> false >> YAML.load "[0,1,2]" =3D> [10] >> You can verify the back end you're using via `YAML::ENGINE.yamler`: irb(main):004:0> YAML::ENGINE.yamler =3D> "psych" irb(main):005:0> Or if you're targeting 1.9.2 and above, just require and use Psych directly: irb(main):001:0> require 'psych' =3D> true irb(main):002:0> Psych.load "[0,1,2]" =3D> [0, 1, 2] irb(main):003:0> Hope that helps. --=20 Aaron Patterson http://tenderlovemaking.com/ --FL5UXtIhxfXey3p5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJPGGbvAAoJEJUxcLy0/6/G67gH/imHL994jHY0OB2E8lSavl6G P3IWPSvcnKOTMhNQs5nmoQCAvhMnvYGC+YGWE0uUuN/92P+7p18QuTKpZatH97Sa JL4J+T7K0fk/7fy8G9WsNBsA66UsDDXvrdJoIeyaKvgKmci7oq3WXfaS1n4R1u6J UUilAsy2oMBUlixY6lh5fb4VvD5IM4cO7s2YHxVRA5wimopyI0FC81cFVirn5few 6eHuUf/6Hczk02lAyUqd6y03YxrTl5540bUoFGG11wb94gP5nOwN44M0co2s/Jf1 NBn8piscSPTPUrr+TRq8ET1qqgr+4ef7z2s2NztWBNp42xp/D3um2sHYiPUgNks= =qNo3 -----END PGP SIGNATURE----- --FL5UXtIhxfXey3p5-- On Fri, Jan 20, 2012 at 01:47:24AM +0900, j.wuttke wrote: > From my understanding of the YAML spec, rule 138, > "[0,1,2]" should be a valid array; but under both > Ruby1.8 and Ruby1.9.3 it is parsed as [0]; to obtain > [0,1,2] I need to write "[0, 1, 2]". This appears to be a bug in Syck. If you install libyaml and recompile 1.9.3, your yaml back end should be Psych. Psych handles this case correctly. With trunk ruby (though 1.9.3 should work if you have libyaml installed): irb(main):001:0> RUBY_VERSION =3D> "2.0.0" irb(main):002:0> require 'yaml' =3D> true irb(main):003:0> YAML.load "[0,1,2]" =3D> [0, 1, 2] irb(main):004:0> With 1.8.7: >> RUBY_VERSION =3D> "1.8.7" >> require 'yaml' =3D> false >> YAML.load "[0,1,2]" =3D> [10] >> You can verify the back end you're using via `YAML::ENGINE.yamler`: irb(main):004:0> YAML::ENGINE.yamler =3D> "psych" irb(main):005:0> Or if you're targeting 1.9.2 and above, just require and use Psych directly: irb(main):001:0> require 'psych' =3D> true irb(main):002:0> Psych.load "[0,1,2]" =3D> [0, 1, 2] irb(main):003:0> Hope that helps. --=20 Aaron Patterson http://tenderlovemaking.com/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJPGGbvAAoJEJUxcLy0/6/G67gH/imHL994jHY0OB2E8lSavl6G P3IWPSvcnKOTMhNQs5nmoQCAvhMnvYGC+YGWE0uUuN/92P+7p18QuTKpZatH97Sa JL4J+T7K0fk/7fy8G9WsNBsA66UsDDXvrdJoIeyaKvgKmci7oq3WXfaS1n4R1u6J UUilAsy2oMBUlixY6lh5fb4VvD5IM4cO7s2YHxVRA5wimopyI0FC81cFVirn5few 6eHuUf/6Hczk02lAyUqd6y03YxrTl5540bUoFGG11wb94gP5nOwN44M0co2s/Jf1 NBn8piscSPTPUrr+TRq8ET1qqgr+4ef7z2s2NztWBNp42xp/D3um2sHYiPUgNks= =qNo3 -----END PGP SIGNATURE-----