class Xconsul::LoadBalance::RoundRobin

Attributes

counter[RW]

attr_accessor :hosts # ['192.168.0.1:8909']

Public Class Methods

new() click to toggle source
# File lib/xconsul/load_balance/round_robin.rb, line 10
def initialize
  @counter = 0
end

Public Instance Methods

select(hosts) click to toggle source

hosts ['192.168.0.1:8909', '192.168.0.2:8901']

# File lib/xconsul/load_balance/round_robin.rb, line 15
def select(hosts)
  idx = @counter % hosts.size
  @counter += 1
  hosts[idx]
end