summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb2
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index 234cabc7f9..984bc84ed3 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/lib/psych/visitors/to_ruby.rb
@@ -305,7 +305,7 @@ module Psych
key = accept(k)
val = accept(v)
- if key == '<<'
+ if key == '<<' && k.tag != "tag:yaml.org,2002:str"
case v
when Nodes::Alias
begin
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index 96260daffa..d73d91aff8 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -16,10 +16,12 @@ module Psych
def initialize
@obj_to_id = {}
@obj_to_node = {}
+ @targets = []
@counter = 0
end
def register target, node
+ @targets << target
@obj_to_node[target.object_id] = node
end
@@ -289,6 +291,11 @@ module Psych
quote = false
elsif o =~ /\n/
style = Nodes::Scalar::LITERAL
+ elsif o == '<<'
+ style = Nodes::Scalar::SINGLE_QUOTED
+ tag = 'tag:yaml.org,2002:str'
+ plain = false
+ quote = false
elsif o =~ /^\W[^"]*$/
style = Nodes::Scalar::DOUBLE_QUOTED
else