Class: Protocol::HTTP::Header::AcceptLanguage::Language
- Inherits:
-
Struct
- Object
- Struct
- Protocol::HTTP::Header::AcceptLanguage::Language
- Defined in:
- lib/protocol/http/header/accept_language.rb
Overview
A parsed language 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 languages by descending quality factor.
-
#quality_factor ⇒ Object
The quality factor for this language.
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
27 28 29 |
# File 'lib/protocol/http/header/accept_language.rb', line 27 def name @name end |
#q ⇒ Object
Returns the value of attribute q
27 28 29 |
# File 'lib/protocol/http/header/accept_language.rb', line 27 def q @q end |
Instance Method Details
#<=>(other) ⇒ Object
Compare languages by descending quality factor.
39 40 41 |
# File 'lib/protocol/http/header/accept_language.rb', line 39 def <=> other other.quality_factor <=> self.quality_factor end |
#quality_factor ⇒ Object
The quality factor for this language.
31 32 33 |
# File 'lib/protocol/http/header/accept_language.rb', line 31 def quality_factor (q || 1.0).to_f end |