method
visit_Psych_Nodes_Sequence
v2_5_5 -
Show latest stable
- Class:
Psych::Visitors::ToRuby
visit_Psych_Nodes_Sequence(o)public
No documentation available.
# File ext/psych/lib/psych/visitors/to_ruby.rb, line 126
def visit_Psych_Nodes_Sequence o
if klass = resolve_class(Psych.load_tags[o.tag])
instance = klass.allocate
if instance.respond_to?(:init_with)
coder = Psych::Coder.new(o.tag)
coder.seq = o.children.map { |c| accept c }
instance.init_with coder
end
return instance
end
case o.tag
when nil
register_empty(o)
when '!omap', 'tag:yaml.org,2002:omap'
map = register(o, Psych::Omap.new)
o.children.each { |a|
map[accept(a.children.first)] = accept a.children.last
}
map
when /^!(?:seq|ruby\/array):(.*)$/
klass = resolve_class($1)
list = register(o, klass.allocate)
o.children.each { |c| list.push accept c }
list
else
register_empty(o)
end
end