diff options
author | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-08-18 20:42:09 +0000 |
---|---|---|
committer | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-08-18 20:42:09 +0000 |
commit | 5e07e55204aede8b5f80e7d01b464f08c6bd611e (patch) | |
tree | 98e5b0c0eb7c6be16839d7c2afff34ed3089a6a2 /lib/yaml/encoding.rb | |
parent | b79d77197f17778a9a63a9b048bd22194418007b (diff) |
* 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
Diffstat (limited to 'lib/yaml/encoding.rb')
-rw-r--r-- | lib/yaml/encoding.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/yaml/encoding.rb b/lib/yaml/encoding.rb index e361163ac6..37f5cfda64 100644 --- a/lib/yaml/encoding.rb +++ b/lib/yaml/encoding.rb @@ -7,8 +7,12 @@ module YAML # # Escape the string, condensing common escapes # - def YAML.escape( value ) - value.gsub( /\\/, "\\\\\\" ).gsub( /"/, "\\\"" ).gsub( /([\x00-\x1f])/ ) { |x| ESCAPES[ x.unpack("C")[0] ] } + def YAML.escape( value, skip = "" ) + value.gsub( /\\/, "\\\\\\" ). + gsub( /"/, "\\\"" ). + gsub( /([\x00-\x1f])/ ) do |x| + skip[x] || ESCAPES[ x.unpack("C")[0] ] + end end # |