Class: NewRelic::Agent::Instrumentation::MiddlewareProxy::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/instrumentation/middleware_proxy.rb

Overview

This class is used to wrap classes that are passed to Rack::Builder#use without synchronously instantiating those classes. A MiddlewareProxy::Generator responds to new, like a Class would, and passes through arguments to new to the original target class.

Instance Method Summary collapse

Constructor Details

#initialize(middleware_class) ⇒ Generator

Returns a new instance of Generator.



26
27
28
# File 'lib/new_relic/agent/instrumentation/middleware_proxy.rb', line 26

def initialize(middleware_class)
  @middleware_class = middleware_class
end

Instance Method Details

#new(*args, &blk) ⇒ Object



30
31
32
33
# File 'lib/new_relic/agent/instrumentation/middleware_proxy.rb', line 30

def new(*args, &blk)
  middleware_instance = @middleware_class.new(*args, &blk)
  MiddlewareProxy.wrap(middleware_instance)
end