Class: Localization::Middleware
- Inherits:
-
Object
- Object
- Localization::Middleware
- Defined in:
- lib/localization-middleware.rb
Instance Attribute Summary collapse
-
#languages ⇒ Object
readonly
Returns the value of attribute languages.
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, langs) ⇒ Middleware
constructor
A new instance of Middleware.
-
#langs ⇒ Object
Returns the value of attribute languages.
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
#languages ⇒ Object
Returns the value of attribute languages.
3 4 5 |
# File 'lib/localization-middleware.rb', line 3 def languages @languages end |
Class Method Details
.languages ⇒ Object
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 |
#langs ⇒ Object
Returns the value of attribute languages.
4 5 6 |
# File 'lib/localization-middleware.rb', line 4 def languages @languages end |