lib/grape/middleware/base.rb in grape-0.0.0.alpha.2 vs lib/grape/middleware/base.rb in grape-0.1.0
- old
+ new
@@ -1,10 +1,12 @@
module Grape
module Middleware
class Base
attr_reader :app, :env, :options
+ # @param [Rack Application] app The standard argument for a Rack middleware.
+ # @param [Hash] options A hash of options, simply stored for use by subclasses.
def initialize(app, options = {})
@app = app
@options = default_options.merge(options)
end
@@ -19,10 +21,15 @@
before
@app_response = @app.call(@env)
after || @app_response
end
+ # @abstract
+ # Called before the application is called in the middleware lifecycle.
def before; end
+ # @abstract
+ # Called after the application is called in the middleware lifecycle.
+ # @returns [Response, nil] a Rack SPEC response or nil to call the application afterwards.
def after; end
def request
Rack::Request.new(self.env)
end
\ No newline at end of file