summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-01-16 10:46:34 -0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-25 15:56:20 +0900
commit03dac55f90bd6b842ffe90b6bfa98af5c0897513 (patch)
treebb3109045e92092d5184b720e7268ae28516f2a3 /ext/psych/lib/psych
parent0016edbead23f2a9b4fa17bcec2798b5bf6a4c07 (diff)
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.
Diffstat (limited to 'ext/psych/lib/psych')
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index 62d1d5c3f4..79ca129b83 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -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}"