Class: Closure::Middleware
- Inherits:
-
Object
- Object
- Closure::Middleware
- Defined in:
- lib/closure/middleware.rb
Overview
Although Closure Script can run as an app or in a cascade, most installations will use this Middleware configured with Closure.add_source().
Instance Method Summary (collapse)
- - call(env)
-
- (Middleware) initialize(app, home_page = nil)
constructor
A new instance of Middleware.
Constructor Details
- (Middleware) initialize(app, home_page = nil)
Returns a new instance of Middleware
30 31 32 33 |
# File 'lib/closure/middleware.rb', line 30 def initialize(app, home_page=nil) @app = app @server = ShowExceptions.new(Server.new(Closure.sources, home_page)) end |
Instance Method Details
- call(env)
35 36 37 38 39 |
# File 'lib/closure/middleware.rb', line 35 def call(env) status, headers, body = @server.call(env) return @app.call(env) if headers["X-Cascade"] == "pass" [status, headers, body] end |