Sha256: c3779fac05500a15ba8e50a43baadeb299bfdcd36777c1156db43c87aba4e58c

Contents?: true

Size: 365 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
attempt_this-0.8.0 lib/attempt_this/exception_type_filter.rb