Class: Schnitzelpress::Static
- Inherits:
-
Object
- Object
- Schnitzelpress::Static
- Defined in:
- lib/schnitzelpress/static.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, public_dir = './public') ⇒ Static
constructor
A new instance of Static.
Constructor Details
#initialize(app, public_dir = './public') ⇒ Static
Returns a new instance of Static.
3 4 5 6 |
# File 'lib/schnitzelpress/static.rb', line 3 def initialize(app, public_dir = './public') @file = Rack::File.new(public_dir) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/schnitzelpress/static.rb', line 8 def call(env) status, headers, body = @file.call(env) if status > 400 @app.call(env) else [status, headers, body] end end |