Class: Rack::Redirector
- Inherits:
-
Object
- Object
- Rack::Redirector
- Defined in:
- lib/rack/redirector.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Redirector
constructor
A new instance of Redirector.
Constructor Details
#initialize(app) ⇒ Redirector
Returns a new instance of Redirector.
11 12 13 |
# File 'lib/rack/redirector.rb', line 11 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 |
# File 'lib/rack/redirector.rb', line 15 def call(env) @app.call(env) rescue RedirectRequest => redirect [302, {'Location' => redirect.location}, []] end |