Alle luned12 marzo 2007, Rebhan, Gilbert ha scritto:
> What't the correct YAML Syntax and how do i access the different
> section from my script that loads the yaml file ?

First point: your second yaml file contains a mistake: you need to put a space 
between the key of a hash and the value, so the second line should be

CVSEXE: "//foobar/c$/tools/cvsnt/cvs.exe"

(note the space after the :)

To access more than one document in a yaml file, you should use 
YAML.load_documents. It reads the data from a String or IO object, parses 
each document and passes the result to the block. In your case, for example

File.open("config.yaml") do |f|
 YAML.load_documents(f) do |d|
  p d
 end
end

{"CVSEXE"=>"//foobar/c$/tools/cvsnt/cvs.exe"}
{"cvsrepos"=>["test", "test1", "foo", "bar", "foobar"]}

At any rate, I don't think you need to use two yaml documents for what you're 
doing. Simply use a top-level hash, with keys CVSEXE and cvsrepos:

---
CVSEXE: "//foobar/c$/tools/cvsnt/cvs.exe"
cvsrepos:
- test
- test1
- foo
- bar
- foobar

YAML.load_file('config.yaml')
=> "CVSEXE"=>"//foobar/c$/tools/cvsnt/cvs.exe", "cvsrepos"=>["test", "test1", "foo", "bar", "foobar"]}

I hope this helps

Stefano