Class: Boar::Handlers::Locale

Inherits:
Generic
  • Object
show all
Defined in:
app/models/boar/handlers/locale.rb

Instance Attribute Summary collapse

Attributes inherited from Generic

#configuration, #service

Instance Method Summary collapse

Methods included from Utils::Basic

#ensure_hash, #get_option, #interpolate

Constructor Details

#initialize(service, options) ⇒ Locale

Returns a new instance of Locale.



12
13
14
15
16
17
# File 'app/models/boar/handlers/locale.rb', line 12

def initialize(service, options)
  super(service)

  # Get the parameter
  @locale_param = self.get_option(options, :locale_param, @configuration.locale_param)
end

Instance Attribute Details

#locale_paramObject (readonly)

Returns the value of attribute locale_param.



10
11
12
# File 'app/models/boar/handlers/locale.rb', line 10

def locale_param
  @locale_param
end

Instance Method Details

#call(*_) ⇒ Object



19
20
21
22
# File 'app/models/boar/handlers/locale.rb', line 19

def call(*_)
  # Retrieve locale from the controller's params.
  @service.controller.params[@locale_param].ensure_string
end