Using YAML Files with comments

Discussion in 'Ruby' started by Marc Heiler, Dec 27, 2008.

  1. Marc Heiler

    Marc Heiler Guest

    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.
    --
    Posted via http://www.ruby-forum.com/.
    Marc Heiler, Dec 27, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,087
  2. RubyQuestions
    Replies:
    0
    Views:
    213
    RubyQuestions
    Dec 3, 2003
  3. Paul Battley

    YAML.dump/YAML.load bug

    Paul Battley, Aug 3, 2005, in forum: Ruby
    Replies:
    0
    Views:
    169
    Paul Battley
    Aug 3, 2005
  4. Eric Promislow
    Replies:
    4
    Views:
    198
    Eric Promislow
    Oct 31, 2006
  5. Replies:
    4
    Views:
    570
    Dr John Stockton
    Jun 3, 2006
Loading...

Share This Page