Sha256: c76e0ee7a56fb72d98751a3e98bfb3a0d24ec0225eddde809862a343f8856138

Contents?: true

Size: 609 Bytes

Versions: 3

Compression:

Stored size: 609 Bytes

Contents

require 'attempt_this/attempt_object.rb'

module AttemptThis
  extend self

  # 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::get_object(enumerator)
    impl.attempt(block)
  end

  def enabled?
    @enabled.nil? || @enabled
  end

  def enabled=(value)
    @enabled = value
  end

  # Resets all static data (scenarios). This is intended to use by tests only (to reset scenarios)
  def self.reset
    AttemptObject.reset
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
attempt_this-1.0.3 lib/attempt_this/attempt_this.rb
attempt_this-1.0.1 lib/attempt_this/attempt_this.rb
attempt_this-1.0.0 lib/attempt_this/attempt_this.rb