class Psych::Visitors::YAMLTree

def visit_array_subclass o

def visit_array_subclass o
  tag = "!ruby/array:#{o.class}"
  ivars = o.instance_variables
  if ivars.empty?
    node = @emitter.start_sequence(nil, tag, false, Nodes::Sequence::BLOCK)
    register o, node
    o.each { |c| accept c }
    @emitter.end_sequence
  else
    node = @emitter.start_mapping(nil, tag, false, Nodes::Sequence::BLOCK)
    register o, node
    # Dump the internal list
    accept 'internal'
    @emitter.start_sequence(nil, nil, true, Nodes::Sequence::BLOCK)
    o.each { |c| accept c }
    @emitter.end_sequence
    # Dump the ivars
    accept 'ivars'
    @emitter.start_mapping(nil, nil, true, Nodes::Sequence::BLOCK)
    ivars.each do |ivar|
      accept ivar
      accept o.instance_variable_get ivar
    end
    @emitter.end_mapping
    @emitter.end_mapping
  end
end