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