From: Magnus Holm Date: 2011-11-08T04:14:02+09:00 Subject: [ruby-core:40819] Re: [ruby-trunk - Feature #5578] Embedded YAML for Ruby 2.0 On Mon, Nov 7, 2011 at 16:30, Kurt Stephens wrote: > Why does YAML need first class status? ��Define a constructor on the YAML module, and use interpolating heredoc. > > require 'pp' > require 'yaml' > def YAML.[]str; YAML.load(str); end > > x = YAML[<<"..."] > a: 1 > b: 2 > c: #{ 1 + 1 } > ... > > pp x Or you can simply define a method called YAML: require 'yaml' def YAML(str); YAML.load(str); end x = YAML <<"..." a: 1 b: 2 ... p x