On Mon, Nov 7, 2011 at 16:30, Kurt  Stephens <ks.ruby / kurtstephens.com> 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