Much simpler way to build todo yaml

https://stackoverflow.com/a/39906916/1586762

thx @asterite 🎉
This commit is contained in:
Vitalii Elenhaupt 2017-12-29 12:09:59 +02:00
parent b27d9ca740
commit 51fa9f024b
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706

View file

@ -53,15 +53,7 @@ module Ameba::Formatter
.compact .compact
.uniq! .uniq!
nodes_builder = YAML::Nodes::Builder.new {rule.name => rule}.to_yaml
nodes_builder.mapping do
rule.name.to_yaml nodes_builder
rule.to_yaml nodes_builder
end
YAML.build do |builder|
nodes_builder.document.to_yaml(builder)
end
end end
end end
end end