Class: Net::TCPClient::Policy::Random

Inherits:
Base
  • Object
show all
Defined in:
lib/net/tcp_client/policy/random.rb

Overview

Policy for connecting to servers in the order specified

Instance Attribute Summary

Attributes inherited from Base

#addresses

Instance Method Summary collapse

Methods inherited from Base

factory, #initialize

Constructor Details

This class inherits a constructor from Net::TCPClient::Policy::Base

Instance Method Details

#each(&block) ⇒ Object

Calls the block once for each server, with the addresses in random order



7
8
9
# File 'lib/net/tcp_client/policy/random.rb', line 7

def each(&block)
  addresses.shuffle.each {|address| block.call(address)}
end