Class: Wellness::Middleware
- Inherits:
-
Object
- Object
- Wellness::Middleware
- Defined in:
- lib/wellness/middleware.rb
Overview
This is to be put into the Rack environment.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #health_details_path ⇒ Object
- #health_status_path ⇒ Object
-
#initialize(app, system, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
permalink #initialize(app, system, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
6 7 8 9 10 |
# File 'lib/wellness/middleware.rb', line 6 def initialize(app, system, ={}) @app = app @system = system = end |
Instance Method Details
permalink #call(env) ⇒ Object
[View source]
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/wellness/middleware.rb', line 20 def call(env) case env['PATH_INFO'] when health_status_path @system.simple_check when health_details_path @system.detailed_check else @app.call(env) end end |
permalink #health_details_path ⇒ Object
[View source]
16 17 18 |
# File 'lib/wellness/middleware.rb', line 16 def health_details_path [:details_path] || '/health/details' end |
permalink #health_status_path ⇒ Object
[View source]
12 13 14 |
# File 'lib/wellness/middleware.rb', line 12 def health_status_path [:status_path] || '/health/status' end |