Sha256: 8e13c88a243b953bb5dfe970eb197b78f149652777021b5f2ef2193c1ace8c0f
Contents?: true
Size: 603 Bytes
Versions: 1
Compression:
Stored size: 603 Bytes
Contents
require 'cellect' module Cellect module Client require 'cellect/client/node_set' require 'cellect/client/connection' # Sets up the set of server nodes def self.node_set @node_set ||= NodeSet.new end def self.connection @connection ||= Connection.new end # Selects a server for a user def self.choose_host host = node_set.nodes.sample host && host['ip'] end # Ensure a previously selected server is still available def self.host_exists?(ip) node_set.nodes.select{ |node| node['ip'] == ip }.length > 0 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cellect-client-2.0.0.beta1 | lib/cellect/client.rb |