Class: Partiarelic::App
- Inherits:
-
Object
- Object
- Partiarelic::App
- Defined in:
- lib/partiarelic/app.rb
Constant Summary collapse
- ACCEPT_METHODS =
['GET', 'HEAD'].freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(path: nil) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(path: nil) ⇒ App
Returns a new instance of App.
6 7 8 |
# File 'lib/partiarelic/app.rb', line 6 def initialize(path: nil) @path = path end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |