Class: Axn::Core::Flow::Handlers::SingleRuleMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/axn/core/flow/handlers/matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(rule, invert: false) ⇒ SingleRuleMatcher

Returns a new instance of SingleRuleMatcher.



10
11
12
13
# File 'lib/axn/core/flow/handlers/matcher.rb', line 10

def initialize(rule, invert: false)
  @rule = rule
  @invert = invert
end

Instance Method Details

#call(exception:, action:) ⇒ Object



15
16
17
18
19
20
# File 'lib/axn/core/flow/handlers/matcher.rb', line 15

def call(exception:, action:)
  result = matches?(exception:, action:)
  @invert ? !result : result
rescue StandardError => e
  Axn::Internal::PipingError.swallow("determining if handler applies to exception", action:, exception: e)
end