struct Athena::Negotiation::AcceptLanguage
inherits Athena::Negotiation::BaseAccept
#
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#
Methods#
#language : String
#
Returns the language for this AcceptLanguage
header.
E.x. if the #language_range
is zh-Hans-CN
, the language would be zh
.
#language_range : String
#
Returns the language range this AcceptLanguage
header represents.
I.e. #header
minus the #quality
and #parameters
.
#region : String | ::Nil
#
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 : String | ::Nil
#
Returns the script, if any, for this AcceptLanguage
header.
E.x. if the #language_range
is zh-Hans-CN
, the script would be hans