Class: Partiarelic::Middleware
- Inherits:
-
Object
- Object
- Partiarelic::Middleware
- Defined in:
- lib/partiarelic/middleware.rb
Constant Summary collapse
- ACCEPT_METHODS =
%w[GET HEAD].freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
5 6 7 8 9 |
# File 'lib/partiarelic/middleware.rb', line 5 def initialize(app, ={}) @app = app @options = @partiarelic_app = App.new() end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/partiarelic/middleware.rb', line 13 def call(env) if env['PATH_INFO'] == @options[:path] && ACCEPT_METHODS.include?(env['REQUEST_METHOD']) @partiarelic_app.call(env) else @app.call(env) end end |