Class: Protocol::HTTP::Header::AcceptEncoding
- Defined in:
- lib/protocol/http/header/accept_encoding.rb
Overview
The ‘accept-encoding` header represents a list of encodings that the client can accept.
Defined Under Namespace
Classes: Encoding
Constant Summary collapse
- ParseError =
Class.new(Error)
- QVALUE =
/0(\.[0-9]{0,3})?|1(\.[0]{0,3})?/
- ENCODING =
/\A(?<name>#{TOKEN})(;q=(?<q>#{QVALUE}))?\z/
Constants inherited from Split
Instance Method Summary collapse
-
#encodings ⇒ Object
Parse the ‘accept-encoding` header value into a list of encodings.
Methods inherited from Split
Constructor Details
This class inherits a constructor from Protocol::HTTP::Header::Split
Instance Method Details
#encodings ⇒ Object
Parse the ‘accept-encoding` header value into a list of encodings.
36 37 38 39 40 41 42 43 44 |
# File 'lib/protocol/http/header/accept_encoding.rb', line 36 def encodings self.map do |value| if match = value.match(ENCODING) Encoding.new(match[:name], match[:q]) else raise ParseError.new("Could not parse encoding: #{value.inspect}") end end end |