1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/yaml/baseemitter.rb: folding now handles double-quoted strings,

fixed problem with extra line feeds at end of folding, whitespace
  opening scalar blocks.

* lib/yaml/rubytypes.rb: subtelties in handling strings with
  non-printable characters and odd whitespace patterns.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
why 2004-08-18 20:42:09 +00:00
parent b79d77197f
commit 5e07e55204
4 changed files with 39 additions and 21 deletions

View file

@ -1,5 +1,6 @@
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
require 'date'
require 'yaml/compat'
#
# Type conversions
#
@ -315,25 +316,24 @@ class String
}
elsif self.is_binary_data?
out.binary_base64( self )
# elsif self =~ /^ |#{YAML::ESCAPE_CHAR}| $/
# complex = false
elsif self =~ /#{YAML::ESCAPE_CHAR}/
out.node_text( self, '"' )
else
out.node_text( self, to_yaml_fold )
end
end
if not complex
else
ostr = if out.options(:KeepValue)
self
elsif empty?
"''"
elsif self =~ /^[^#{YAML::WORD_CHAR}\/]| \#|#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}]( |$)| $|\n|\'/
"\"#{YAML.escape( self )}\""
out.node_text( self, '"' ); nil
elsif YAML.detect_implicit( self ) != 'str'
"\"#{YAML.escape( self )}\""
out.node_text( self, '"' ); nil
else
self
end
out.simple( ostr )
out.simple( ostr ) unless ostr.nil?
end
}
end