Class: Indexer::WebUI::Server::IndexHTML
- Inherits:
-
Object
- Object
- Indexer::WebUI::Server::IndexHTML
- Defined in:
- lib/indexer/webui.rb
Overview
Rack middleware to serve index.html
file by default.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, root) ⇒ IndexHTML
constructor
A new instance of IndexHTML.
Constructor Details
Instance Method Details
#call(env) ⇒ Object
140 141 142 143 144 145 146 147 148 |
# File 'lib/indexer/webui.rb', line 140 def call(env) path = Rack::Utils.unescape(env['PATH_INFO']) index_file = File.join(@root, path, 'index.html') if File.exists?(index_file) [200, {'Content-Type' => 'text/html'}, File.new(index_file)] else @app.call(env) #Rack::Directory.new(@root).call(env) end end |