From: Aaron Patterson Date: 2011-11-09T01:08:43+09:00 Subject: [ruby-core:40849] Re: [ruby-trunk - Feature #5578] Embedded YAML for Ruby 2.0 --MfFXiAuoTsnnDAfZ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 08, 2011 at 04:14:02AM +0900, Magnus Holm wrote: > On Mon, Nov 7, 2011 at 16:30, Kurt Stephens w= rote: > > Why does YAML need first class status? =A0Define a constructor on the Y= AML module, and use interpolating heredoc. > > > > require 'pp' > > require 'yaml' > > def YAML.[]str; YAML.load(str); end > > > > x =3D YAML[<<"..."] > > a: 1 > > b: 2 > > c: #{ 1 + 1 } > > ... > > > > pp x >=20 > Or you can simply define a method called YAML: >=20 > require 'yaml' > def YAML(str); YAML.load(str); end >=20 > x =3D YAML <<"..." > a: 1 > b: 2 > ... > p x I will add this. --=20 Aaron Patterson http://tenderlovemaking.com/ --MfFXiAuoTsnnDAfZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJOuVQEAAoJEJUxcLy0/6/GBgwIAJDDmi88NaYrY9uPiRS1M/Jl iZPLjLWtvL1Y2evbHgOubPVDdFZV3bYR0UMC3UqnObUAp7JqWZSDGMmD1yVKcd/i /GsWbbZaAEmhehVZtoB+eV3dtueud32NftnGI0j11Li3xliYOWltqcjW1/rEySs/ XfCYa+1hpcjp5QS4oKc413qnNfS+mlRvozX18/SX1jc8L+X1lObvGCrkpHbMEKx5 ImyhX6DTriGy3WhlNYt5Dgptur7UMw7hQBlHDxQoypyDZM06M7jHJm3aq5OoeiCs bUGft/VqVByi9f4pyw7BLaMuhDteQmSfnAxeT4ez2cxwriNSZJodK/B07X8lbrg= =FLzB -----END PGP SIGNATURE----- --MfFXiAuoTsnnDAfZ--