Module: MetrixWire::Instrument::RackBuilder::Patch
- Defined in:
- lib/metrixwire/instrument/rack_builder.rb
Instance Method Summary collapse
Instance Method Details
#to_app ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/metrixwire/instrument/rack_builder.rb', line 25 def to_app app = super return app if app.nil? return app if defined?(::Rails) && ::Rails.respond_to?(:application) && ::Rails.application # Wrap once. Marking the built app prevents re-wrapping if to_app runs # more than once (e.g. nested builders). return app if app.instance_variable_get(:@__metrixwire_wrapped) wrapped = MetrixWire::Rack.new(app) wrapped.instance_variable_set(:@__metrixwire_wrapped, true) wrapped rescue StandardError super end |