diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-17 03:15:54 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-17 03:15:54 +0000 |
commit | 653b0bcbafcbddc9811c06e984f1bbeee2330ddf (patch) | |
tree | 62b3cdc8384a993e90fd7f679867d8f833d72863 /ext/psych | |
parent | 24c6a7c3680b7a4b40526e28391fabe5e5c36ce3 (diff) | |
download | ruby-653b0bcbafcbddc9811c06e984f1bbeee2330ddf.tar.gz |
* ext/psych/lib/psych/visitors/yaml_tree.rb: use literal YAML style
when emitting multi-line strings. Thanks @atambo
* test/psych/test_yaml.rb: test for change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych')
-rw-r--r-- | ext/psych/lib/psych/visitors/yaml_tree.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 9cbc05df4a..d420abd64e 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -231,15 +231,18 @@ module Psych plain = false quote = false style = Nodes::Scalar::ANY + tag = nil + str = o if binary?(o) str = [o].pack('m').chomp tag = '!binary' # FIXME: change to below when syck is removed #tag = 'tag:yaml.org,2002:binary' style = Nodes::Scalar::LITERAL + elsif o =~ /\n/ + quote = true + style = Nodes::Scalar::LITERAL else - str = o - tag = nil quote = !(String === @ss.tokenize(o)) plain = !quote end |