Protocol::HTTPSourceProtocolHTTPHeaderTETransferCoding

class TransferCoding

A single transfer coding entry with optional quality factor

Definitions

def quality_factor

The quality factor for this transfer coding.

Signature

returns Float

the parsed quality factor, defaulting to 1.0.

Implementation

def quality_factor
	(q || 1.0).to_f
end

def <=>(other)

Compare transfer codings by descending quality factor.

Signature

parameter other TransferCoding

the other transfer coding to compare.

returns Integer

the comparison result.

Implementation

def <=> other
	other.quality_factor <=> self.quality_factor
end

def to_s

Convert the transfer coding entry to a header value.

Signature

returns String

the formatted transfer coding with quality factor when present.

Implementation

def to_s
	if q && q != 1.0
		"#{name};q=#{q}"
	else
		name.to_s
	end
end