Class: Rack::ICU4X::Locale::Detector::Cookie
- Inherits:
-
Object
- Object
- Rack::ICU4X::Locale::Detector::Cookie
- Defined in:
- lib/rack/icu4x/locale/detector/cookie.rb
Overview
Detects locale from a cookie value.
Instance Method Summary collapse
-
#call(env) ⇒ String?
Locale from cookie, or nil if not present.
-
#initialize(name = DEFAULT_NAME) ⇒ Cookie
constructor
A new instance of Cookie.
Constructor Details
#initialize(name = DEFAULT_NAME) ⇒ Cookie
Returns a new instance of Cookie.
23 24 25 |
# File 'lib/rack/icu4x/locale/detector/cookie.rb', line 23 def initialize(name=DEFAULT_NAME) @name = name end |
Instance Method Details
#call(env) ⇒ String?
Returns Locale from cookie, or nil if not present.
29 30 31 32 33 34 35 |
# File 'lib/rack/icu4x/locale/detector/cookie.rb', line 29 def call(env) = ::Rack::Utils.(env) locale = [@name] return nil if locale.nil? || locale.empty? locale end |