class Partiarelic::App

Constants

ACCEPT_METHODS

Public Class Methods

new(path: nil) click to toggle source
# File lib/partiarelic/app.rb, line 6
def initialize(path: nil)
  @path = path
end

Public Instance Methods

call(env) click to toggle source
# File lib/partiarelic/app.rb, line 12
def call(env)
  unless ACCEPT_METHODS.include?(env['REQUEST_METHOD']) && (@path ? env['PATH_INFO'] == @path : true)
    return [404, {'Content-Type' => 'text/plain'}, []]
  end

  NewRelic::Agent.manual_start

  headers = {'Content-Type' => 'text/plain'}
  if env['REQUEST_METHOD'] == 'HEAD'
    [200, headers, []]
  else
    [200, headers, [Socket.gethostname]]
  end
end