Class: Goliath::Rack::Heartbeat
- Inherits:
-
Object
- Object
- Goliath::Rack::Heartbeat
- Defined in:
- lib/goliath/rack/heartbeat.rb
Overview
A heartbeat mechanism for the server. This will add a /status endpoint that returns status 200 and content OK when executed.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Heartbeat
constructor
A new instance of Heartbeat.
Constructor Details
#initialize(app) ⇒ Heartbeat
Returns a new instance of Heartbeat.
10 11 12 |
# File 'lib/goliath/rack/heartbeat.rb', line 10 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/goliath/rack/heartbeat.rb', line 14 def call(env) if env['PATH_INFO'] == '/status' [200, {}, 'OK'] else @app.call(env) end end |