Sha256: 023ab9bc341d1ef506574cbb21292cf525f21327250e35c72506fade5f444255

Contents?: true

Size: 887 Bytes

Versions: 12

Compression:

Stored size: 887 Bytes

Contents

# frozen_string_literal: true

module Soaspec
  # Ways of repeating an exchange to reach a desired outcome
  module ExchangeRepeater
    # Wait until the passed block returns true
    # @param [Hash] opts Options for this instance
    # @option opts [Numeric] :timeout (5) Seconds to wait before timing out.
    # @option opts [Numeric] :interval (0.2) Seconds to sleep between polls.
    # @option opts [String] :message Exception message if timed out.
    # @option opts [Array, Exception] :ignore Exceptions to ignore while polling (default: Error::NoSuchElementError)
    # @return [Exchange] Returns itself so operations can be done on the exchange after it's done waiting
    def until(opts = {}, &script)
      Soaspec::Wait.until(opts) do
        @response = nil # Reset response so it can be made repeatedly
        instance_eval(&script)
      end
      self
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
soaspec-0.3.11 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.10 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.9 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.8 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.7 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.6 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.3 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.2 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.3.1 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.2.32 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.2.31 lib/soaspec/exchange/exchange_repeater.rb
soaspec-0.2.30 lib/soaspec/exchange/exchange_repeater.rb