Method: Bundler::URI::RFC2396_Parser#unescape

Defined in:
lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb

#unescape(str, escaped = ) ⇒ Object

:call-seq:

unescape( str )
unescape( str, escaped )

Args

str

String to remove escapes from

escaped

Regexp to apply. Defaults to self.regexp[:ESCAPED]

Description

Removes escapes from str.


318
319
320
321
322
# File 'lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb', line 318

def unescape(str, escaped = @regexp[:ESCAPED])
  enc = str.encoding
  enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
  str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end