Method: Atatus::Spies::SinatraSpy#install
- Defined in:
- lib/atatus/spies/sinatra.rb
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/atatus/spies/sinatra.rb', line 25 def install if defined?(::Sinatra) && defined?(::Sinatra::Base) && ::Sinatra::Base.private_method_defined?(:dispatch!) && ::Sinatra::Base.private_method_defined?(:compile_template) ::Sinatra::Base.class_eval do alias dispatch_without_apm! dispatch! alias compile_template_without_apm compile_template def dispatch!(*args, &block) dispatch_without_apm!(*args, &block).tap do next unless (transaction = Atatus.current_transaction) next unless (route = env['sinatra.route']) transaction.name = route end end def compile_template(engine, data, opts, *args, &block) opts[:__atatus_template_name] = case data when Symbol then data.to_s else format('Inline %s', engine) end compile_template_without_apm(engine, data, opts, *args, &block) end end end end |