Class: TheMask::ProxyList

Inherits:
Object
  • Object
show all
Defined in:
lib/the_mask/proxy_list.rb

Defined Under Namespace

Classes: Proxy

Instance Method Summary collapse

Constructor Details

#initialize(arr = []) ⇒ ProxyList

Returns a new instance of ProxyList.



24
25
26
27
# File 'lib/the_mask/proxy_list.rb', line 24

def initialize(arr = [])
  @proxy_list ||= []
  arr.each{ |element| @proxy_list << [TheMask::ProxyList::Proxy.new(element), 0] } unless arr.empty?
end

Instance Method Details

#get_proxyObject



29
30
31
32
33
# File 'lib/the_mask/proxy_list.rb', line 29

def get_proxy
  @proxy_list = @proxy_list.sort_by(&:last) # Least used proxy
  @proxy_list[0] = [@proxy_list[0][0], @proxy_list[0][1] + 1]
  @proxy_list[0][0]
end