Class: HealthcheckEndpoint::RackMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/healthcheck_endpoint/rack_middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, resolver = HealthcheckEndpoint::Resolver, counfigured = !!HealthcheckEndpoint.configuration) ⇒ RackMiddleware

Returns a new instance of RackMiddleware.



5
6
7
8
9
10
11
12
13
# File 'lib/healthcheck_endpoint/rack_middleware.rb', line 5

def initialize(
  app,
  resolver = HealthcheckEndpoint::Resolver,
  counfigured = !!HealthcheckEndpoint.configuration
)
  @app = app
  @resolver = resolver
  @counfigured = counfigured
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
# File 'lib/healthcheck_endpoint/rack_middleware.rb', line 15

def call(env)
  raise HealthcheckEndpoint::Error::Configuration::NotConfigured unless counfigured

  resolver.call(env) || app.call(env)
end