Class: AcceptLanguage::Parser
- Inherits:
-
Object
- Object
- AcceptLanguage::Parser
- Defined in:
- lib/accept_language/parser.rb
Overview
Parser is a utility class responsible for parsing Accept-Language header fields. It processes the field to extract language tags and their respective quality values.
Constant Summary collapse
- DEFAULT_QUALITY =
BigDecimal("1")
- SEPARATOR =
","
- SPACE =
" "
- SUFFIX =
";q="
Instance Attribute Summary collapse
-
#languages_range ⇒ Object
readonly
Returns the value of attribute languages_range.
Instance Method Summary collapse
-
#initialize(field) ⇒ Parser
constructor
Initializes a new Parser instance by importing and processing the given Accept-Language header field.
-
#match(*available_langtags) ⇒ String, ...
Uses the Matcher class to find the best language match from the list of available languages.
Constructor Details
#initialize(field) ⇒ Parser
Initializes a new Parser instance by importing and processing the given Accept-Language header field.
25 26 27 |
# File 'lib/accept_language/parser.rb', line 25 def initialize(field) @languages_range = import(field) end |
Instance Attribute Details
#languages_range ⇒ Object (readonly)
Returns the value of attribute languages_range.
20 21 22 |
# File 'lib/accept_language/parser.rb', line 20 def languages_range @languages_range end |