Class: Strelka::HTTPRequest::Encoding
- Inherits:
-
AcceptParam
- Object
- AcceptParam
- Strelka::HTTPRequest::Encoding
- Defined in:
- lib/strelka/httprequest/acceptparams.rb
Overview
A content encoding parameter, such as one you’d find in an Accept-Encoding header.
Constant Summary
Constants inherited from AcceptParam
AcceptParam::Q_DEFAULT, AcceptParam::Q_MAX
Instance Attribute Summary
Attributes inherited from AcceptParam
#extensions, #qvalue, #subtype, #type
Class Method Summary collapse
-
.parse(accept_param) ⇒ Object
Parse the given
accept_paramas a content coding and return a Strelka::HTTPRequest::Encoding object for it.
Instance Method Summary collapse
-
#to_s ⇒ Object
Return the parameter as a String suitable for inclusion in an Accept-language header.
Methods inherited from AcceptParam
#<=>, #=~, #extension_strings, #initialize, #inspect, #qvaluestring
Methods included from AbstractClass
extended, included, #inherited, #pure_virtual
Constructor Details
This class inherits a constructor from Strelka::HTTPRequest::AcceptParam
Class Method Details
.parse(accept_param) ⇒ Object
Parse the given accept_param as a content coding and return a Strelka::HTTPRequest::Encoding object for it.
293 294 295 296 297 298 |
# File 'lib/strelka/httprequest/acceptparams.rb', line 293 def self::parse( accept_param ) content_coding, *stuff = accept_param.split( /\s*;\s*/ ) qval, opts = stuff.partition {|par| par =~ /^q\s*=/ } return new( content_coding, nil, qval.first, *opts ) end |
Instance Method Details
#to_s ⇒ Object
Return the parameter as a String suitable for inclusion in an Accept-language header.
310 311 312 313 314 315 316 |
# File 'lib/strelka/httprequest/acceptparams.rb', line 310 def to_s return [ self.content_coding, self.qvaluestring, self.extension_strings, ].compact.join( ';' ) end |