Method: AcceptLanguage.parse
- Defined in:
- lib/accept_language.rb
.parse(field) ⇒ Parser
Parses an Accept-Language header field value and returns a parser instance that can be used to match against available languages.
The parser handles all aspects of the Accept-Language specification:
-
Quality values (+q=0+ to q=1, default
1when omitted) -
Language range validation per RFC 4647 Section 2.1
-
Wildcards (+*+)
-
Case normalization (matching is case-insensitive)
Invalid language ranges or malformed quality values in the input are silently ignored, allowing the parser to handle real-world headers that may not strictly conform to specifications.
268 269 270 |
# File 'lib/accept_language.rb', line 268 def self.parse(field) Parser.new(field) end |