Class: Checkend::Filters::IgnoreFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/checkend/filters/ignore_filter.rb

Overview

IgnoreFilter determines whether an exception should be ignored.

It checks the exception against the configured ignored_exceptions list, supporting class names, classes, and regular expressions.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ IgnoreFilter

Returns a new instance of IgnoreFilter.



11
12
13
# File 'lib/checkend/filters/ignore_filter.rb', line 11

def initialize(config)
  @ignored_exceptions = config.ignored_exceptions
end

Instance Method Details

#ignore?(exception) ⇒ Boolean

Check if an exception should be ignored

Parameters:

  • exception (Exception) —

    the exception to check

Returns:

  • (Boolean) —

    true if should be ignored



19
20
21
22
23
24
25
# File 'lib/checkend/filters/ignore_filter.rb', line 19

def ignore?(exception)
  exception_class_name = exception.class.name

  @ignored_exceptions.any? do |pattern|
    matches?(exception, exception_class_name, pattern)
  end
end