class Strelka::HTTPRequest::Encoding

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

Public Class Methods

parse( accept_param ) click to toggle source

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

to_s() click to toggle source

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