I need to generate this yaml programmatically in Rails:
foo: &foo
x: 1
y: 2
bar:
<<: *foo
z: 3
which when it's parsed should give this hash:
output = {
:foo => {
:x => 1,
:y => 2
},
:bar => {
:x => 1,
:y => 2,
:z => 3
}
}
Obviously output.to_yaml
gives the expanded syntax. Is there any way to output the yml syntax with anchor and nodes programmatically.