Class: Locomotive::Middlewares::LocaleRedirection
- Defined in:
- lib/locomotive/middlewares/locale_redirection.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ LocaleRedirection
constructor
A new instance of LocaleRedirection.
Constructor Details
#initialize(app, opts = {}) ⇒ LocaleRedirection
Returns a new instance of LocaleRedirection.
5 6 7 |
# File 'lib/locomotive/middlewares/locale_redirection.rb', line 5 def initialize(app, opts = {}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/locomotive/middlewares/locale_redirection.rb', line 9 def call(env) if url = redirect_url(env) redirect_to url else @app.call(env) end end |