Class: TraceViz::Collectors::Filters::IncludeGemsFilter
- Inherits:
-
BaseFilter
- Object
- BaseFilter
- TraceViz::Collectors::Filters::IncludeGemsFilter
- Defined in:
- lib/trace_viz/collectors/filters/include_gems_filter.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ app_running: true, gems: [], }.freeze
Instance Method Summary collapse
- #apply?(trace_data) ⇒ Boolean
-
#initialize(**options) ⇒ IncludeGemsFilter
constructor
A new instance of IncludeGemsFilter.
Methods included from Helpers::ConfigHelper
#config, #fetch_general_config
Constructor Details
#initialize(**options) ⇒ IncludeGemsFilter
Returns a new instance of IncludeGemsFilter.
14 15 16 17 18 19 20 21 22 |
# File 'lib/trace_viz/collectors/filters/include_gems_filter.rb', line 14 def initialize(**) super() @include_app = .fetch(:app_running, DEFAULT_OPTIONS[:app_running]) @app_path = [:app_path] || detect_app_path @app_path.freeze @included_gems = .fetch(:gems, DEFAULT_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
24 25 26 |
# File 'lib/trace_viz/collectors/filters/include_gems_filter.rb', line 24 def apply?(trace_data) app_path_included?(trace_data.path) || included_gem?(trace_data.path) end |