summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/visitors/yaml_tree.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-29 21:02:19 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-29 21:02:19 +0000
commit7a5dedf25c81aac6d14c35110e42f2f01d01a103 (patch)
tree0ad059dbece2076ec2b391f09253a448fafa3ae9 /ext/psych/lib/psych/visitors/yaml_tree.rb
parent7df9a77da1947c617662148f6485dc58967277f2 (diff)
* ext/psych/lib/psych/visitors/to_ruby.rb: quoted "<<" strings
should not be treated as merge keys. * ext/psych/lib/psych/visitors/yaml_tree.rb: hashes with keys containing "<<" should roundtrip. * test/psych/test_merge_keys.rb: test for change. Fixes GH #203 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych/visitors/yaml_tree.rb')
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb7
1 files changed, 7 insertions, 0 deletions
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