Class: Async::App::WebServer::HealthApp
- Inherits:
-
Object
- Object
- Async::App::WebServer::HealthApp
- Includes:
- Component
- Defined in:
- lib/async/app/web_server/health_app.rb
Constant Summary collapse
- PATHS =
["/health", "/health/"].freeze
Instance Method Summary collapse
- #call(_) ⇒ Object
- #can_handle?(request) ⇒ Boolean
-
#initialize ⇒ HealthApp
constructor
A new instance of HealthApp.
Methods included from Component
Constructor Details
#initialize ⇒ HealthApp
Returns a new instance of HealthApp.
8 9 10 11 12 |
# File 'lib/async/app/web_server/health_app.rb', line 8 def initialize @healthy = false bus.subscribe("health.updated") { @healthy = _1 } end |
Instance Method Details
#call(_) ⇒ Object
15 |
# File 'lib/async/app/web_server/health_app.rb', line 15 def call(_) = [@healthy ? 200 : 500] |
#can_handle?(request) ⇒ Boolean
14 |
# File 'lib/async/app/web_server/health_app.rb', line 14 def can_handle?(request) = PATHS.include?(request.path) |