Class: TheMask::ProxyList
- Inherits:
-
Object
- Object
- TheMask::ProxyList
- Defined in:
- lib/the_mask/proxy_list.rb
Defined Under Namespace
Classes: Proxy
Instance Method Summary collapse
- #get_proxy ⇒ Object
-
#initialize(arr = []) ⇒ ProxyList
constructor
A new instance of ProxyList.
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_proxy ⇒ Object
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 |