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
#initialize(app, system, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
9 10 11 12 13 |
# File 'lib/wellness/middleware.rb', line 9 def initialize(app, system, ={}) @app = app @system = system @options = end |
Instance Method Details
#call(env) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/wellness/middleware.rb', line 23 def call(env) case env['PATH_INFO'] when health_status_path Wellness::SimpleReport.new(@system).call when health_details_path Wellness::DetailedReport.new(@system).call else @app.call(env) end end |
#health_details_path ⇒ Object
19 20 21 |
# File 'lib/wellness/middleware.rb', line 19 def health_details_path @options[:details_path] || '/health/details' end |
#health_status_path ⇒ Object
15 16 17 |
# File 'lib/wellness/middleware.rb', line 15 def health_status_path @options[:status_path] || '/health/status' end |