Module: HTTP::Accept::QuotedString
- Defined in:
- lib/http/accept/quoted_string.rb
Class Method Summary collapse
-
.unquote(value, normalize_whitespace = true) ⇒ Object
Unquote a “quoted-string” value according to tools.ietf.org/html/rfc7230#section-3.2.6 It should already match the QUOTED_STRING pattern above by the parser.
Class Method Details
.unquote(value, normalize_whitespace = true) ⇒ Object
Unquote a “quoted-string” value according to tools.ietf.org/html/rfc7230#section-3.2.6 It should already match the QUOTED_STRING pattern above by the parser.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/http/accept/quoted_string.rb', line 30 def self.unquote(value, normalize_whitespace = true) value = value[1...-1] value.gsub!(/\\(.)/, '\1') if normalize_whitespace # LWS = [CRLF] 1*( SP | HT ) value.gsub!(/[\r\n]+\s+/, ' ') end return value end |