Class: Localization::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/localization-middleware.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, langs) ⇒ Middleware

Returns a new instance of Middleware.



12
13
14
15
# File 'lib/localization-middleware.rb', line 12

def initialize(app, langs)
  @app = app
  self.languages = langs
end

Instance Attribute Details

#languagesObject

Returns the value of attribute languages.



3
4
5
# File 'lib/localization-middleware.rb', line 3

def languages
  @languages
end

Class Method Details

.languagesObject



7
8
9
# File 'lib/localization-middleware.rb', line 7

def languages
  @languages
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/localization-middleware.rb', line 17

def call(env)
  @env = env
  set_locale
  response_array = @app.call(@env)
  unset_locale
  response_array
end

#langsObject

Returns the value of attribute languages.



4
5
6
# File 'lib/localization-middleware.rb', line 4

def languages
  @languages
end