Class: Madness::Static
- Inherits:
-
Object
- Object
- Madness::Static
- Defined in:
- lib/madness/static.rb
Overview
The Madness::Static middleware delegates requests to Rack::TryStatic middleware unless the request URI ends with .md
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options) ⇒ Static
constructor
A new instance of Static.
Constructor Details
#initialize(app, options) ⇒ Static
Returns a new instance of Static.
6 7 8 9 |
# File 'lib/madness/static.rb', line 6 def initialize(app, ) @app = app @static = ::Rack::TryStatic.new(app, ) end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/madness/static.rb', line 11 def call(env) if env['PATH_INFO'].end_with? ".md" @app.call env else @static.call env end end |