Using YAML Files with comments

M

Marc Heiler

Years ago when I started to use yaml files more heavily I also started
to grow accustomed to the habit of commenting my yaml files - within
that yaml file.

The question I now have is whether if it is possible to save those
comments when saving the yaml file. To my current knowledge this is not
possible when writing a yaml file such as:

YAML_FILE = "/x.yml"
File.open(YAML_FILE, 'w') { |file| YAML.dump(tree.file) }

(Note, I actually assume that x.yml already exists and contains
information, including comments.)

I think my problem is that yaml files were thought to be equivalent to
"config files" - on Linux you often see config files which contain
comments - however if I loose all my comments always, I really can not
use yaml files for _all_ config files; only for those config files where
I dont need in-file comments.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top