class AttemptThis::ExceptionTypeFilter

Type-based exception filter.

Public Class Methods

new(exception_classes) click to toggle source

Initializer.

# File lib/attempt_this/exception_type_filter.rb, line 5
def initialize(exception_classes)
  @exception_classes = Array.new(exception_classes)
end

Public Instance Methods

include?(exception) click to toggle source

Tells whether the given exception satisfies the filter.

# File lib/attempt_this/exception_type_filter.rb, line 10
def include?(exception)
  @exception_classes.any?{|klass| exception.is_a?(klass)}
end