Sha256: 96fe3ed3cc40b65dc282b6a58c127dfc1c556bd1821b689e5d2f25a3bfd95512

Contents?: true

Size: 351 Bytes

Versions: 3

Compression:

Stored size: 351 Bytes

Contents

module Net
  class TCPClient
    module Policy
      # Policy for connecting to servers in the order specified
      class Random < Base
        # Calls the block once for each server, with the addresses in random order
        def each(&block)
          addresses.shuffle.each {|address| block.call(address)}
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
net_tcp_client-2.2.0 lib/net/tcp_client/policy/random.rb
net_tcp_client-2.0.1 lib/net/tcp_client/policy/random.rb
net_tcp_client-2.0.0 lib/net/tcp_client/policy/random.rb