Ruby YAML force double quotes when dumping
I have a small script to automate some things in YAML files.
I read the original YAML file, convert it into a hash and then dump it to
the file after modifying it.
File.open(output_file, "w") do |out|
YAML.dump(modified_hash, out)
end
That works fine, but it removes double quotes around the string if they
aren't needed. That's valid YAML, but it doesn't look very nice.
As a solution, I could add a space at the end of every string, but I'm not
too happy with that. Is there any way of forcing double quotes around
strings?
No comments:
Post a Comment