Class: Blacksheep::Decorators::Localizer

Inherits:
ActionDecorator show all
Defined in:
lib/blacksheep/decorators/localizer.rb

Instance Method Summary collapse

Methods inherited from ActionDecorator

#__class__, #class, #decorators_chain

Instance Method Details

#call(params, current_user: nil, **options) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/blacksheep/decorators/localizer.rb', line 7

def call(params, current_user: nil, **options)
  if (locale = params[:_locale])
    I18n.with_locale(locale) do
      super
    end
  else
    super
  end
end

#perform(params, current_user: nil, **options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/blacksheep/decorators/localizer.rb', line 17

def perform(params, current_user: nil, **options)

  if (locale = params[:_locale])
    I18n.with_locale(locale) do
      super
    end
  else
    super
  end
end