summaryrefslogtreecommitdiff
path: root/ext/psych
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-13 22:45:16 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-13 22:45:16 +0000
commit8a4cc4e02a2dc161008f9df99dfe6fb9698de649 (patch)
treef264ef5abc38aaa61c66aa4d1c48ecd422d0a854 /ext/psych
parent3738ebe15aaedcf4cf38021ade61909c84707b93 (diff)
* ext/psych/lib/psych/visitors/yaml_tree.rb: quote strings that begin
with non-word characters. Thanks Alex Tambellini! * test/psych/test_yaml.rb: appropriate test case git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych')
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index d420abd..5efb654 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -242,6 +242,9 @@ module Psych
elsif o =~ /\n/
quote = true
style = Nodes::Scalar::LITERAL
+ elsif o =~ /^\W/
+ quote = true
+ style = Nodes::Scalar::DOUBLE_QUOTED
else
quote = !(String === @ss.tokenize(o))
plain = !quote