YAML::Syck::Map.children_with_index has a non-useless mode?

Ruboids:

I have some dirt-simple YAML, and I need to traverse the object model
returned by YAML.parse().

So if the top-level object is a Map (corresponding naturally to a native
Hash), how do I get the keys and values?

Try this:

    map.children_with_index.each do |kid, key|
            p kid
            p key
          end

The 'key's come out healthy Scalars, but the 'kid's are always nil!
Permutations involving map[key] and map.at(key) also return nil, because
that's what

Oh why can't I get non-nil kids from my map?? (Without using map.value[key]
to go down to the Hash - because I don't want to!)

···

--
  Phlip
  http://www.greencheese.us/ZeekLand <-- NOT a blog!!!

Phlip wrote:

Ruboids:

I have some dirt-simple YAML, and I need to traverse the object model
returned by YAML.parse().

So if the top-level object is a Map (corresponding naturally to a native
Hash), how do I get the keys and values?

Try this:

    map.children_with_index.each do |kid, key|
            p kid
            p key
          end

The 'key's come out healthy Scalars, but the 'kid's are always nil!
Permutations involving map[key] and map.at(key) also return nil, because
that's what

Oh why can't I get non-nil kids from my map?? (Without using
map.value[key] to go down to the Hash - because I don't want to!)

The problem might lie in your code, or your YAML database. The parts that
are not in your message.

···

--
Paul Lutus
http://www.arachnoid.com