diff options
Diffstat (limited to 'lib/yaml/encoding.rb')
-rw-r--r-- | lib/yaml/encoding.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/yaml/encoding.rb b/lib/yaml/encoding.rb index 37f5cfda64..57dc553606 100644 --- a/lib/yaml/encoding.rb +++ b/lib/yaml/encoding.rb @@ -10,8 +10,8 @@ module YAML def YAML.escape( value, skip = "" ) value.gsub( /\\/, "\\\\\\" ). gsub( /"/, "\\\"" ). - gsub( /([\x00-\x1f])/ ) do |x| - skip[x] || ESCAPES[ x.unpack("C")[0] ] + gsub( /([\x00-\x1f])/ ) do + skip[$&] || ESCAPES[ $&.unpack("C")[0] ] end end @@ -19,7 +19,7 @@ module YAML # Unescape the condenses escapes # def YAML.unescape( value ) - value.gsub( /\\(?:([nevfbart\\])|0?x([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/ ) { |x| + value.gsub( /\\(?:([nevfbart\\])|0?x([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/ ) { if $3 ["#$3".hex ].pack('U*') elsif $2 |