Sha256: 4e56b0526d2134e6707200fff0748cd3f2e9b8d989b7c70e46c942e4329fe4d0

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 Bytes

Contents

::Sinatra::Base.class_eval do
  alias_method :dispatch_without_tracebin!, :dispatch!

  def dispatch!(*args, &block)
    start_time = ::Tracebin::PatchHelper.timestamp_string
    result = dispatch_without_tracebin!(*args, *block)
    end_time = ::Tracebin::PatchHelper.timestamp_string
    route = env['sinatra.route']

    event_data = [
      'sinatra.route',
      start_time,
      end_time,
      {
        endpoint: route
      }
    ]

    ::Tracebin::Patches.handle_event :sinatra, event_data

    result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tracebin-0.0.13 lib/tracebin/patches/sinatra.rb
tracebin-0.0.12 lib/tracebin/patches/sinatra.rb
tracebin-0.0.11 lib/tracebin/patches/sinatra.rb