Class: HealthyRack::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/healthy_rack/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, path:) ⇒ Middleware

Returns a new instance of Middleware.



5
6
7
8
# File 'lib/healthy_rack/middleware.rb', line 5

def initialize(app, path:)
  @app = app
  @path = path
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/healthy_rack/middleware.rb', line 10

def call(env)
  request = Rack::Request.new(env)
  if request.path_info == path
    App.call(env)
  else
    app.call(env)
  end
end