From: Aaron Patterson Date: 2010-08-29T07:24:12+09:00 Subject: [ruby-core:31917] Re: [Bug #3112] require "yaml" doesn't use psych as default --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 27, 2010 at 09:09:27PM +0900, Anshul Khandelwal wrote: > Issue #3112 has been updated by Anshul Khandelwal. >=20 >=20 > Any updates on this? Is there some way I can ensure that my code is usin= g the bundled psych? Psych is an "opt-in" experience for 1.9.2. I'm not sure when we'll make it the default YAML object. There are two ways you can use Psych. The first way is to just require psych and reference the Psych constant: require 'psych' =20 Psych.load '--- hello world!' Psych.dump { :goodbye =3D> 'cruel world' } The second way is to change the YAML engine: require 'yaml' YAML::ENGINE.yamler =3D 'psych' YAML.load '--- hello world!' YAML.dump { :goodbye =3D> 'cruel world' } Setting the engine will replace the YAML constant with the Psych constant. Using the first example will absolutely guarantee using Psych. The second example cannot guarantee usage because other libraries could possibly set the engine back to "syck" without your knowledge. --=20 Aaron Patterson http://tenderlovemaking.com/ --azLHFNyN32YCQGCU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iQEcBAEBAgAGBQJMeYyPAAoJEJUxcLy0/6/GU2YIAJrr0Xpbmrxs16D9ZkPHG2FC dg92Rah1Q7NMn4DYTh8fLl5fn/pVmzqqgfK+RklGHJx+sEuswE09VInzxYkMZlY9 fusZDiGGe2yAZx3OlCIm7GKAQ3CEScL3WR7HeA6gZep7rOfe6U8qHJRXU0XesOBe sK8A9biktU08PtLaO4XdnbDGTHp1HPIteaB6xnsd1Oc+zPtXOGm+nz+B6QJPW+to s2Y9uTmnvCUCufqp89oCyvf0xeUIeUUQ14tameesvX0Ogg+lYfbdN2RspIYx9kKW urZk1QfrCtvZyz6hyGPLnqYExNjhQijWnl+AN65mVDy5klu6HIe2fpQo6C8AUkE= =8jlg -----END PGP SIGNATURE----- --azLHFNyN32YCQGCU--