summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/visitors/to_ruby.rb6
-rw-r--r--lib/psych/visitors/yaml_tree.rb1
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index 1289ff9..2790cde 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/lib/psych/visitors/to_ruby.rb
@@ -74,6 +74,8 @@ module Psych
}
args.push(args.delete_at(1) == '...')
Range.new(*args)
+ when /^!ruby\/sym(bol)?:?(.*)?$/
+ o.value.to_sym
else
@ss.tokenize o.value
end
@@ -170,7 +172,9 @@ module Psych
when /^!ruby\/object:?(.*)?$/
name = $1 || 'Object'
- revive((resolve_class(name) || Object), o)
+ obj = revive((resolve_class(name) || Object), o)
+ @st[o.anchor] = obj if o.anchor
+ obj
else
hash = {}
@st[o.anchor] = hash if o.anchor
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb
index 83f11bf..523cfe1 100644
--- a/lib/psych/visitors/yaml_tree.rb
+++ b/lib/psych/visitors/yaml_tree.rb
@@ -54,6 +54,7 @@ module Psych
end
map = append Nodes::Mapping.new(nil, tag, false)
+ register(o, map)
@stack.push map
dump_ivars(o, map)