Class: Airbrake::Rack::UserFilter

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

Overview

Adds current user information.

Since:

  • v8.0.1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUserFilter

Returns a new instance of UserFilter.

Since:

  • v8.0.1



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

def initialize
  @weight = 99
end

Instance Attribute Details

#weightInteger (readonly)

Returns:

  • (Integer)

Since:

  • v8.0.1



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

def weight
  @weight
end

Instance Method Details

#call(notice) ⇒ Object

See Also:

  • FilterChain#refine

Since:

  • v8.0.1



17
18
19
20
21
22
# File 'lib/airbrake/rack/user_filter.rb', line 17

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

  user = Airbrake::Rack::User.extract(request.env)
  notice[:context].merge!(user.as_json) if user
end