Sha256: 077120ad32782dde1864890a440f4ccaa9df5fe332ceb3b1f5537045e0a72e30

Contents?: true

Size: 339 Bytes

Versions: 1

Compression:

Stored size: 339 Bytes

Contents

require 'attempt_this/attempt_object.rb'

module AttemptThis
	# Attempts code block until it doesn't throw an exception or the end of enumerator has been reached.
	def attempt(enumerator, &block)
		raise(ArgumentError, 'Nil enumerator!') if enumerator.nil?

		impl = AttemptObject.new(enumerator)
		impl.attempt(block)
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attempt_this-0.8.0 lib/attempt_this.rb