Represents an HTTP Accept-Language header according to the HTTP 1.1 specification, and provides several convenience methods for determining acceptable content languages.
Returns an array of languages from this header that match the given language, ordered by precedence.
# File lib/rack/accept/language.rb, line 25 def matches(language) values.select {|v| v == language || v == '*' || (language.match(/^(.+?)-/) && v == $1) }.sort {|a, b| # "*" gets least precedence, any others are compared based on length. a == '*' ? -1 : (b == '*' ? 1 : a.length <=> b.length) }.reverse end
Generated with the Darkfish Rdoc Generator 2.