Class: Elasticsearch::Paramedic::Rack::Middleware
- Inherits:
-
Rack::Static
- Object
- Rack::Static
- Elasticsearch::Paramedic::Rack::Middleware
- Defined in:
- lib/elasticsearch-paramedic-rack/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
7 8 9 |
# File 'lib/elasticsearch-paramedic-rack/middleware.rb', line 7 def initialize app super app, :root => Elasticsearch::Paramedic::Rack::ROOT, :urls => [PATH] end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/elasticsearch-paramedic-rack/middleware.rb', line 11 def call env case env["PATH_INFO"] when PATH return [302, {"Location" => "#{PATH}/", "Content-Type" => "text/plain"}, []] when "#{PATH}/" env["PATH_INFO"] = "#{PATH}/index.html" end super end |