Class: Webhookdb::Webterm::RedirectIndexHtmlToRoot

Inherits:
Object
  • Object
show all
Defined in:
lib/webterm/apps.rb

Constant Summary collapse

REDIRECTS =
["", "/index.html"].freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RedirectIndexHtmlToRoot

Returns a new instance of RedirectIndexHtmlToRoot.



19
20
21
# File 'lib/webterm/apps.rb', line 19

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



23
24
25
26
# File 'lib/webterm/apps.rb', line 23

def call(env)
  return [302, {"Location" => "/terminal/"}, []] if REDIRECTS.include?(env[Rack::PATH_INFO])
  return @app.call(env)
end