Sha256: e1629d4567b918feb8b9996daa945ed14318d8ad2f0c0a9bc059e8a9684cf63b

Contents?: true

Size: 351 Bytes

Versions: 2

Compression:

Stored size: 351 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

2 entries across 2 versions & 1 rubygems

Version Path
attempt_this-0.9.0 lib/attempt_this/exception_type_filter.rb
attempt_this-0.8.1 lib/attempt_this/exception_type_filter.rb