Object
# File lib/safe_yaml/syck_resolver.rb, line 18 def resolve_map(node) map = node.value hash = {} # Take the "<<" key nodes first, as these are meant to approximate a form of inheritance. inheritors = map.keys.select { |node| resolve_node(node) == "<<" } inheritors.each do |key| value_node = map.delete(key) hash.merge!(resolve_node(value_node)) end # All that's left should be normal (non-"<<") nodes. map.each do |key_node, value_node| hash[resolve_node(key_node)] = resolve_node(value_node) end return hash end
# File lib/safe_yaml/syck_resolver.rb, line 5 def resolve_node(node) case node.value when Hash return resolve_map(node) when Array return resolve_seq(node) when String return resolve_scalar(node) else raise "Don't know how to resolve this node: #{node.inspect}" end end
Generated with the Darkfish Rdoc Generator 2.