Dump Hash ivars before elements

When the Hash is revived, the ivars will be set before elements.  This
is for the case when the hash setter depends on ivars set on the hash.
This commit is contained in:
Aaron Patterson 2019-01-16 10:46:34 -08:00 коммит произвёл Hiroshi SHIBATA
Родитель 0016edbead
Коммит 03dac55f90
1 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -428,15 +428,6 @@ module Psych
node = @emitter.start_mapping(nil, tag, false, Psych::Nodes::Mapping::BLOCK)
register(o, node)
# Dump the elements
accept 'elements'
@emitter.start_mapping nil, nil, true, Nodes::Mapping::BLOCK
o.each do |k,v|
accept k
accept v
end
@emitter.end_mapping
# Dump the ivars
accept 'ivars'
@emitter.start_mapping nil, nil, true, Nodes::Mapping::BLOCK
@ -446,6 +437,15 @@ module Psych
end
@emitter.end_mapping
# Dump the elements
accept 'elements'
@emitter.start_mapping nil, nil, true, Nodes::Mapping::BLOCK
o.each do |k,v|
accept k
accept v
end
@emitter.end_mapping
@emitter.end_mapping
else
tag = "!ruby/hash:#{o.class}"