Class: Wellness::Middleware

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

Overview

This is to be put into the Rack environment.

Author:

  • Matthew A. Johnston

Instance Method Summary collapse

Constructor Details

#initialize(app, system, options = {}) ⇒ Middleware

Returns a new instance of Middleware.



8
9
10
11
12
13
14
15
# File 'lib/wellness/middleware.rb', line 8

def initialize(app, system, options={})
  @app = app
  @system = system

  # Optional arguments
  @health_status_path = options[:status_path] || '/health/status'
  @health_details_path = options[:details_path] || '/health/details'
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/wellness/middleware.rb', line 17

def call(env)
  case env['PATH_INFO']
  when @health_status_path
    health_status_check
  when @health_details_path
    health_details_check
  else
    @app.call(env)
  end
end