method
visit_Psych_Nodes_Sequence
v1_9_3_392 -
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 107
def visit_Psych_Nodes_Sequence o
if klass = 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 '!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
list = register(o, [])
o.children.each { |c| list.push accept c }
list
end
end