class AcceptCharset
The accept-charset
header represents a list of character sets that the client can accept.
Definitions
CHARSET = /\A(?<name>#{TOKEN})(;q=(?<q>#{QVALUE}))?\z/
https://tools.ietf.org/html/rfc7231#section-5.3.3
def charsets
Parse the accept-charset
header value into a list of character sets.
Signature
-
returns
Array(Charset)
the list of character sets and their associated quality factors.
Implementation
def charsets
self.map do |value|
if match = value.match(CHARSET)
Charset.new(match[:name], match[:q])
else
raise ParseError.new("Could not parse character set: #{value.inspect}")
end
end
end