Athena::Negotiation::AcceptLanguage
Inherits Athena::Negotiation::BaseAccept < Struct < Value < Object
Represents an Accept-Language header character set.
accept = ANG::AcceptLanguage.new "zh-Hans-CN; q = 0.3; key=value"
accept.header # => "zh-Hans-CN; q = 0.3; key=value"
accept.normalized_header # => "zh-Hans-CN; key=value"
accept.parameters # => {"key" => "value"}
accept.quality # => 0.3
accept.language # => "zh"
accept.region # => "cn"
accept.script # => "hans"
Constructors
Instance methods
language
Returns the language for this AcceptLanguage header.
E.x. if the #language_range is zh-Hans-CN, the language would be zh.
language_range
Returns the language range this AcceptLanguage header represents.
I.e. #header minus the #quality and #parameters.
region
Returns the region, if any, for this AcceptLanguage header.
E.x. if the #language_range is zh-Hans-CN, the region would be cn
script
Returns the script, if any, for this AcceptLanguage header.
E.x. if the #language_range is zh-Hans-CN, the script would be hans