summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/visitors/to_ruby.rb1
-rw-r--r--lib/psych/visitors/yast_builder.rb6
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index ee603ff..e585a01 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/lib/psych/visitors/to_ruby.rb
@@ -15,6 +15,7 @@ module Psych
unless o.quoted
return nil if o.value =~ /^(null|~)$/i or o.value.empty?
+ return o.value.sub(/^:/,'').to_sym if o.value =~ /^:/
end
o.value
diff --git a/lib/psych/visitors/yast_builder.rb b/lib/psych/visitors/yast_builder.rb
index 52eae59..c3bd55d 100644
--- a/lib/psych/visitors/yast_builder.rb
+++ b/lib/psych/visitors/yast_builder.rb
@@ -21,7 +21,7 @@ module Psych
end
def visit_String o
- quote = !!(o =~ /^(null|~)$/i or o.empty?)
+ quote = !!(o =~ /^(null|~)$/i or o =~ /^:/ or o.empty?)
scalar = Nodes::Scalar.new(o, nil, nil, !quote, quote)
@stack.last.children << scalar
@@ -52,6 +52,10 @@ module Psych
append Nodes::Scalar.new('', nil, 'tag:yaml.org,2002:null', false)
end
+ def visit_Symbol o
+ append Nodes::Scalar.new ":#{o}"
+ end
+
private
def append o
@stack.last.children << o