mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/syck/token.c: preserve newlines prepended to a block.
* ext/syck/implicit.c (syck_match_implicit): added !merge and !default. * lib/yaml/constants.rb: remove '\z' escape. * lib/yaml/emitter.rb: ensure reset of @seq_map shortcut flag. * lib/yaml/encoding.rb: remove Unicode translation methods. * lib/yaml/rubytypes.rb: improved round-tripping of Strings. [ruby-core:1134] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3079dcab4a
commit
e921ea2d78
7 changed files with 2019 additions and 1967 deletions
|
@ -295,20 +295,21 @@ class String
|
|||
if complex
|
||||
if self.is_binary_data?
|
||||
out.binary_base64( self )
|
||||
elsif self =~ /^ |#{YAML::ESCAPE_CHAR}| $/
|
||||
complex = false
|
||||
else
|
||||
out.node_text( self )
|
||||
end
|
||||
else
|
||||
end
|
||||
if not complex
|
||||
ostr = if out.options[:KeepValue]
|
||||
self
|
||||
elsif empty?
|
||||
"''"
|
||||
elsif self =~ /^[^#{YAML::WORD_CHAR}]|#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}]( |$)| $|\n|\'/
|
||||
"\"#{YAML.escape( self )}\""
|
||||
elsif YAML.detect_implicit( self ) != 'str'
|
||||
"\"#{YAML.escape( self )}\""
|
||||
elsif self =~ /#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}] |\n|\'/
|
||||
"\"#{YAML.escape( self )}\""
|
||||
elsif self =~ /^[^#{YAML::WORD_CHAR}]/
|
||||
"\"#{YAML.escape( self )}\""
|
||||
else
|
||||
self
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue