Sha256: e992c3c36bef5aa7871a937fc77dbd222f712b8bd87654405ca128af4b3e6db8

Contents?: true

Size: 372 Bytes

Versions: 5

Compression:

Stored size: 372 Bytes

Contents

module AttemptThis
  # Type-based exception filter.
  class ExceptionTypeFilter
    # Initializer.
    def initialize(exception_classes)
      @exception_classes = Array.new(exception_classes)
    end

    # Tells whether the given exception satisfies the filter.
    def include?(exception)
      @exception_classes.any?{|klass| exception.is_a?(klass)}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attempt_this-1.0.3 lib/attempt_this/exception_type_filter.rb
attempt_this-1.0.2 lib/attempt_this/exception_type_filter.rb
attempt_this-1.0.1 lib/attempt_this/exception_type_filter.rb
attempt_this-1.0.0 lib/attempt_this/exception_type_filter.rb
attempt_this-0.9.1 lib/attempt_this/exception_type_filter.rb