Class: Elasticsearch::Transport::Transport::Connections::Selector::Random

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/elasticsearch/transport/transport/connections/selector.rb

Overview

“Random connection” selector strategy.

Instance Attribute Summary

Attributes included from Base

#connections

Instance Method Summary collapse

Methods included from Base

#initialize

Instance Method Details

#select(options = {}) ⇒ Connections::Connection

Returns a random connection from the collection.



54
55
56
# File 'lib/elasticsearch/transport/transport/connections/selector.rb', line 54

def select(options={})
  connections.to_a.send( defined?(RUBY_VERSION) && RUBY_VERSION > '1.9' ? :sample : :choice)
end