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



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

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

#quality_factorObject



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

def quality_factor
	(q || 1.0).to_f
end

#to_sObject



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

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