class Leafy::Rack::Ping

Public Class Methods

new(app, path = '/ping') click to toggle source
# File leafy-rack/lib/leafy/rack/ping.rb, line 15
def initialize(app, path = '/ping')
  @app = app
  @path = path
end
response() click to toggle source
# File leafy-rack/lib/leafy/rack/ping.rb, line 6
def self.response
  [ 
   200, 
   { 'Content-Type' => 'text/plain',
     'Cache-Control' => 'must-revalidate,no-cache,no-store' }, 
   [ 'pong' ]
  ]
end

Public Instance Methods

call(env) click to toggle source
# File leafy-rack/lib/leafy/rack/ping.rb, line 20
def call(env)
  if env['PATH_INFO'] == @path
    Ping.response
  else
    @app.call( env )
  end
end