Class: Net::TCPClient::Policy::Random
- 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
Instance Method Summary collapse
-
#each(&block) ⇒ Object
Calls the block once for each server, with the addresses in random order.
Methods inherited from Base
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 |