Class: Vanilla::Static
- Inherits:
-
Object
- Object
- Vanilla::Static
- Defined in:
- lib/vanilla/static.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, root) ⇒ Static
constructor
A new instance of Static.
Constructor Details
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vanilla/static.rb', line 11 def call(env) path = env['PATH_INFO'].chomp('/') method = env['REQUEST_METHOD'] if %w(GET HEAD).include?(method) && file_exist?(path) @file_server.call(env) else @app.call(env) end end |