Class: Rack::HalBrowser::Redirect
- Inherits:
-
Object
- Object
- Rack::HalBrowser::Redirect
- Defined in:
- lib/rack/hal_browser/redirect.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}, &block) ⇒ Redirect
constructor
A new instance of Redirect.
Constructor Details
#initialize(app, options = {}, &block) ⇒ Redirect
Returns a new instance of Redirect.
9 10 11 12 13 |
# File 'lib/rack/hal_browser/redirect.rb', line 9 def initialize(app, = {}, &block) @app = app @excluded_paths = Array([:exclude]) << '/hal-browser' @hal_browser = Rack::Static.new(@app, :urls => ['/hal-browser'], :root => ::File.('../../../../vendor', __FILE__)) end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rack/hal_browser/redirect.rb', line 15 def call(env) request = Rack::Request.new(env) if match?(request) return [303, {'Location' => hal_browser_url_from_request(request)}, []] end @hal_browser.call(env) end |