Class: Protocol::HTTP::Header::TE::TransferCoding

Inherits:
Struct
  • Object
show all
Defined in:
lib/protocol/http/header/te.rb

Overview

A single transfer coding entry with optional quality factor

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



47
48
49
# File 'lib/protocol/http/header/te.rb', line 47

def name
  @name
end

#qObject

Returns the value of attribute q

Returns:

  • (Object)

    the current value of q



47
48
49
# File 'lib/protocol/http/header/te.rb', line 47

def q
  @q
end

Instance Method Details

#<=>(other) ⇒ Object

Compare transfer codings by descending quality factor.



59
60
61
# File 'lib/protocol/http/header/te.rb', line 59

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

#quality_factorObject

The quality factor for this transfer coding.



51
52
53
# File 'lib/protocol/http/header/te.rb', line 51

def quality_factor
	(q || 1.0).to_f
end

#to_sObject

Convert the transfer coding entry to a header value.



66
67
68
69
70
71
72
# File 'lib/protocol/http/header/te.rb', line 66

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