Class: Airbrake::Rack::RouteFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrake/rack/route_filter.rb

Overview

Adds route slugs to context/route.

Since:

  • v7.5.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouteFilter

Returns a new instance of RouteFilter.

Since:

  • v7.5.0



12
13
14
# File 'lib/airbrake/rack/route_filter.rb', line 12

def initialize
  @weight = 100
end

Instance Attribute Details

#weightObject (readonly)

Since:

  • v7.5.0



10
11
12
# File 'lib/airbrake/rack/route_filter.rb', line 10

def weight
  @weight
end

Instance Method Details

#call(notice) ⇒ Object

Since:

  • v7.5.0



16
17
18
19
20
21
22
23
24
25
# File 'lib/airbrake/rack/route_filter.rb', line 16

def call(notice)
  return unless (request = notice.stash[:rack_request])

  notice[:context][:route] =
    if action_dispatch_request?(request)
      rails_route(request)
    elsif sinatra_request?(request)
      sinatra_route(request)
    end
end