Class: TraceViz::Collectors::Filters::ExcludeGemsFilter

Inherits:
BaseFilter
  • Object
show all
Defined in:
lib/trace_viz/collectors/filters/exclude_gems_filter.rb

Instance Method Summary collapse

Methods included from Helpers::ConfigHelper

#config, #fetch_general_config

Constructor Details

#initialize(**options) ⇒ ExcludeGemsFilter

Returns a new instance of ExcludeGemsFilter.



9
10
11
12
13
14
# File 'lib/trace_viz/collectors/filters/exclude_gems_filter.rb', line 9

def initialize(**options)
  super()
  @excluded_gems = options[:gems].map do |gem_name|
    ::Gem.loaded_specs[gem_name]&.full_gem_path
  end.compact.freeze
end

Instance Method Details

#apply?(trace_data) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/trace_viz/collectors/filters/exclude_gems_filter.rb', line 16

def apply?(trace_data)
  !excluded_gem?(trace_data.path)
end