Class: Xenon::ContentCodingRange
- Inherits:
-
Object
- Object
- Xenon::ContentCodingRange
- Defined in:
- lib/xenon/headers/accept_encoding.rb
Constant Summary collapse
- DEFAULT_Q =
1.0
Instance Attribute Summary collapse
-
#coding ⇒ Object
readonly
Returns the value of attribute coding.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(coding, q = DEFAULT_Q) ⇒ ContentCodingRange
constructor
A new instance of ContentCodingRange.
- #to_s ⇒ Object
Constructor Details
#initialize(coding, q = DEFAULT_Q) ⇒ ContentCodingRange
Returns a new instance of ContentCodingRange.
10 11 12 13 |
# File 'lib/xenon/headers/accept_encoding.rb', line 10 def initialize(coding, q = DEFAULT_Q) @coding = coding @q = Float(q) || DEFAULT_Q end |
Instance Attribute Details
#coding ⇒ Object (readonly)
Returns the value of attribute coding.
6 7 8 |
# File 'lib/xenon/headers/accept_encoding.rb', line 6 def coding @coding end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
6 7 8 |
# File 'lib/xenon/headers/accept_encoding.rb', line 6 def q @q end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 |
# File 'lib/xenon/headers/accept_encoding.rb', line 15 def <=>(other) @q <=> other.q end |
#to_s ⇒ Object
19 20 21 22 23 |
# File 'lib/xenon/headers/accept_encoding.rb', line 19 def to_s s = @coding.dup s << "; q=#{@q}" if @q != DEFAULT_Q s end |