Class: Rack::ServerStatus
- Inherits:
-
Object
- Object
- Rack::ServerStatus
- Defined in:
- lib/rack/server_status.rb,
lib/rack/server_status/version.rb
Defined Under Namespace
Classes: Remover
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ ServerStatus
constructor
A new instance of ServerStatus.
Constructor Details
#initialize(app, options = {}) ⇒ ServerStatus
Returns a new instance of ServerStatus.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/server_status.rb', line 7 def initialize(app, = {}) @app = app @uptime = Time.now.to_i @skip_ps_command = [:skip_ps_command] || false @path = [:path] || '/server-status' @allow = [:allow] || [] scoreboard_path = [:scoreboard_path] unless scoreboard_path.nil? @scoreboard = WorkerScoreboard.new(scoreboard_path) end end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rack/server_status.rb', line 19 def call(env) set_state!('A', env) @clean_proc = Remover.new ObjectSpace.define_finalizer(self, @clean_proc) if @path && env['PATH_INFO'] == @path res = handle_server_status(env) set_state!('_') return res end res = @app.call(env) set_state!('_') return res end |