class Rack::StayingAlive

Constants

HEADERS
VERSION

Public Class Methods

new(app, options = {}) click to toggle source
# File lib/rack/staying_alive.rb, line 5
def initialize(app, options = {})
  @app = app

  @headers = HEADERS.dup
  @headers.merge!(options[:headers]) if options[:headers]

  @routes = options[:routes] || ['/ah-ha-ha-ha']
  @response = options[:response] || 'staying alive'
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/staying_alive.rb, line 15
def call(env)
  if @routes.include?(env['PATH_INFO'])
    [200, @headers, [@response]]
  else
    @app.call(env)
  end
end