Class: SidekiqRemappableErrors::ErrorMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_remappable_errors/error_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ErrorMatcher

Returns a new instance of ErrorMatcher.



5
6
7
8
9
10
# File 'lib/sidekiq_remappable_errors/error_matcher.rb', line 5

def initialize(config)
  validate_config!(config)

  @klass = config[0]
  @regex = config[1]
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



12
13
14
# File 'lib/sidekiq_remappable_errors/error_matcher.rb', line 12

def klass
  @klass
end

#regexObject (readonly)

Returns the value of attribute regex.



12
13
14
# File 'lib/sidekiq_remappable_errors/error_matcher.rb', line 12

def regex
  @regex
end

Instance Method Details

#match?(error) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/sidekiq_remappable_errors/error_matcher.rb', line 14

def match?(error)
  @klass.to_s == error.class.to_s && error.message.match(@regex)
end