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
1 changed files with 1 additions and 9 deletions

View File

@ -53,15 +53,7 @@ module Ameba::Formatter
.compact
.uniq!
nodes_builder = YAML::Nodes::Builder.new
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
{rule.name => rule}.to_yaml
end
end
end