From: Phlip Date: 2006-12-12T15:00:06+09:00 Subject: Non-useless mode for YAML::Syck::Map.children_with_index? Rubistas: Here's a complete working sample illustrating the issue in YAML::Syck, or its documentation: require 'yaml' y = YAML.parse("i: b\na: sequence") p y.kind # <-- :seq y.children_with_index.each do |me_nil, me_key| p me_nil # <-- nil p me_key # <-- a Scalar p me_key.value # <-- i, a p y[me_key] # <-- nil y.value[me_key] # <-- the real child object! end The general goal is very simple: To walk the object model, all the way from the root :seq down to a leaf Scalar, without ever stepping out of Syck objects, into Hash or Array objects. The reason is because they might have different features, so I might lose some Syck abilities. This might just be impossible, so I need to know that before committing to any one strategy. Incidentally, the existing implementation solves the primary mismatch between the OMap object (which I also cannot figure out how to grab directly) and the Hash, whose keys are in an undefined sequence. The children_with_index returns the indices in the correct order, so the last line y.value[key] can then get the children in the right order. But yet children_with_index doesn't return the children... -- Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!!