Class: Airbrake::Filters::DependencyFilter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrake-ruby/filters/dependency_filter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Attaches loaded dependencies to the notice object.

Since:

  • v2.10.0

Instance Method Summary collapse

Constructor Details

#initializeDependencyFilter

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.

Returns a new instance of DependencyFilter.

Since:

  • v2.10.0



8
9
10
# File 'lib/airbrake-ruby/filters/dependency_filter.rb', line 8

def initialize
  @weight = 117
end

Instance Method Details

#call(notice) ⇒ void

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.

This method returns an undefined value.

This is a mandatory method required by any filter integrated with FilterChain.

Parameters:

  • notice (Notice)

    the notice to be filtered

See Also:

Since:

  • v2.10.0



13
14
15
16
17
18
19
20
21
# File 'lib/airbrake-ruby/filters/dependency_filter.rb', line 13

def call(notice)
  deps = {}
  Gem.loaded_specs.map.with_object(deps) do |(name, spec), h|
    h[name] = "#{spec.version}#{git_version(spec)}"
  end

  notice[:context][:versions] = {} unless notice[:context].key?(:versions)
  notice[:context][:versions][:dependencies] = deps
end