Class: AttemptThis::ExceptionTypeFilter
- Inherits:
-
Object
- Object
- AttemptThis::ExceptionTypeFilter
- Defined in:
- lib/attempt_this/exception_type_filter.rb
Overview
Type-based exception filter.
Instance Method Summary collapse
-
#include?(exception) ⇒ Boolean
Tells whether the given exception satisfies the filter.
-
#initialize(exception_classes) ⇒ ExceptionTypeFilter
constructor
Initializer.
Constructor Details
#initialize(exception_classes) ⇒ ExceptionTypeFilter
Initializer.
5 6 7 |
# File 'lib/attempt_this/exception_type_filter.rb', line 5 def initialize(exception_classes) @exception_classes = Array.new(exception_classes) end |
Instance Method Details
#include?(exception) ⇒ Boolean
Tells whether the given exception satisfies the filter.
10 11 12 |
# File 'lib/attempt_this/exception_type_filter.rb', line 10 def include?(exception) @exception_classes.any?{|klass| exception.is_a?(klass)} end |