struct Athena::Negotiation::AcceptLanguage
- Athena::Negotiation::AcceptLanguage
- Athena::Negotiation::BaseAccept
- Struct
- Value
- Object
Overview
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"
Defined in:
accept_language.crConstructors
Instance Method Summary
-
#language : String
Returns the language for this
AcceptLanguageheader. -
#language_range : String
Returns the language range this
AcceptLanguageheader represents. -
#region : String | Nil
Returns the region, if any, for this
AcceptLanguageheader. -
#script : String | Nil
Returns the script, if any, for this
AcceptLanguageheader.
Instance methods inherited from struct Athena::Negotiation::BaseAccept
header : String
header,
normalized_header : String
normalized_header,
parameters : Hash(String, String)
parameters,
quality : Float32
quality
Constructor methods inherited from struct Athena::Negotiation::BaseAccept
new(header : String)
new
Constructor Detail
Instance Method Detail
Returns the language for this AcceptLanguage header.
E.x. if the #language_range is zh-Hans-CN, the language would be zh.
Returns the language range this AcceptLanguage header represents.
I.e. #header minus the #quality and #parameters.
Returns the region, if any, for this AcceptLanguage header.
E.x. if the #language_range is zh-Hans-CN, the region would be cn
Returns the script, if any, for this AcceptLanguage header.
E.x. if the #language_range is zh-Hans-CN, the script would be hans