class TheMask::ProxyList
Attributes
proxy_list[RW]
Public Class Methods
new(arr = [])
click to toggle source
# File lib/the_mask/proxy_list.rb, line 50 def initialize(arr = []) @proxy_list ||= [] arr.each do |element| @proxy_list << [TheMask::ProxyList::Proxy.new(element), 0] unless arr.empty? end end
Public Instance Methods
get_proxy()
click to toggle source
# File lib/the_mask/proxy_list.rb, line 58 def get_proxy if @proxy_list.empty? raise "Tried to get_proxy when proxy list is empty. Check that your input proxy list is populated." end @proxy_list = @proxy_list.sort_by(&:last) # Least used proxy list sort by 2nd element in inner array @proxy_list[0] = [@proxy_list[0][0], @proxy_list[0][1] + 1] @proxy_list[0][0] end
remove_proxy!(proxy)
click to toggle source
# File lib/the_mask/proxy_list.rb, line 68 def remove_proxy!(proxy) @proxy_list.delete(proxy) end