Class: Protocol::HTTP::Header::AcceptCharset::Charset
- Inherits:
-
Struct
- Object
- Struct
- Protocol::HTTP::Header::AcceptCharset::Charset
- Defined in:
- lib/protocol/http/header/accept_charset.rb
Overview
A parsed character set entry with an optional quality factor.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#q ⇒ Object
Returns the value of attribute q.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Compare character sets by descending quality factor.
-
#quality_factor ⇒ Object
The quality factor for this character set.
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
21 22 23 |
# File 'lib/protocol/http/header/accept_charset.rb', line 21 def name @name end |
#q ⇒ Object
Returns the value of attribute q
21 22 23 |
# File 'lib/protocol/http/header/accept_charset.rb', line 21 def q @q end |
Instance Method Details
#<=>(other) ⇒ Object
Compare character sets by descending quality factor.
33 34 35 |
# File 'lib/protocol/http/header/accept_charset.rb', line 33 def <=> other other.quality_factor <=> self.quality_factor end |
#quality_factor ⇒ Object
The quality factor for this character set.
25 26 27 |
# File 'lib/protocol/http/header/accept_charset.rb', line 25 def quality_factor (q || 1.0).to_f end |