diff options
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 # |