Strelka::HTTPRequest::

Encoding

class
Superclass
Strelka::HTTPRequest::AcceptParam

A content encoding parameter, such as one you'd find in an Accept-Encoding header.

Public Class Methods

anchor
parse( accept_param )

Parse the given accept_param as a content coding and return a Strelka::HTTPRequest::Encoding object for it.

# File lib/strelka/httprequest/acceptparams.rb, line 292
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

Public Instance Methods

anchor
to_s()

Return the parameter as a String suitable for inclusion in an Accept-language header.

# File lib/strelka/httprequest/acceptparams.rb, line 309
def to_s
        return [
                self.content_coding,
                self.qvaluestring,
                self.extension_strings,
        ].compact.join( ';' )
end