How can I emit comments in a YAML document using P

2019-01-28 22:27发布

问题:

This question is an exact duplicate of:

  • Adding comment to YAML programmatically 1 answer

I want to generate a YAML document with some comments between sequence elements but I can't really figure out how to do this. Any pointers?

回答1:

You can’t emit YAML documents containing comments with Psych. Psych basically dumps a Hash, and you can’t have comments in a Hash either.



标签: ruby yaml psych