Sha256: 7dec918517ea2347c5df1fa66a8d6d9b59e033f63a3ac3cbb61f81245249a2b1
Contents?: true
Size: 636 Bytes
Versions: 4
Compression:
Stored size: 636 Bytes
Contents
module ProconBypassMan class ServerPool def initialize(servers: ) if servers.nil? || servers.empty? return end @servers = servers if @servers.size >= 1 @index = 0 else @index = nil end end def pick if @index.nil? return @servers&.first end @servers[@index] or raise "bug!!!" end def server; pick; end def next! inc_index if @servers[@index].nil? reset return end end private def reset @index = 0 end def inc_index @index = @index + 1 end end end
Version data entries
4 entries across 4 versions & 1 rubygems