From: Ben Giddings Date: 2005-08-18T13:33:42+09:00 Subject: Re: YANQ: Nesting in YAML On Wednesday 17 August 2005 22:51, basi wrote: > I feel that the structure below: {[[[...]]]}, that is, hash embeds > array which embeds another array makes it easier to pick off keys and > values than the other structure (though, honestly, I haven't gone that > far yet). > > {"an"=> > [ "at sf", > "fc di", > "ps"=> > ["na vb", > "ex anEx"]], > "ps"=> > ["na no", > "ex otherEx", > "pr pro"]]], > "in"=> > ["at sf", > "fc lo"] > } This doesn't look like a hash containing an array to me. The "ps" entries inside look like they're hashes, the key is "ps", the value is an array containing ["na vb", "ex anEx"]... In any event, I think if you have value: stuff in YAML, it will decide it's a hash entry. Array entries start with '-'. If you don't care about the "ps" keys: irb(main):004:0> puts ["at sf", "fc di", ["na vb", "ex anEx"],["na no", "ex otherEx", "pr pro"]].to_yaml --- - at sf - fc di - - na vb - ex anEx - - na no - ex otherEx - pr pro Ben