Class: Twitterscraper::Proxy::Pool
- Inherits:
-
Object
- Object
- Twitterscraper::Proxy::Pool
- Defined in:
- lib/twitterscraper/proxy.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ Pool
constructor
A new instance of Pool.
- #sample ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ Pool
Returns a new instance of Pool.
10 11 12 13 |
# File 'lib/twitterscraper/proxy.rb', line 10 def initialize @items = Proxy.get_proxies @cur_index = 0 end |
Instance Method Details
#empty? ⇒ Boolean
27 28 29 |
# File 'lib/twitterscraper/proxy.rb', line 27 def empty? @items.empty? end |
#sample ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/twitterscraper/proxy.rb', line 15 def sample if @cur_index >= @items.size reload end @cur_index += 1 @items[@cur_index - 1] end |
#size ⇒ Object
23 24 25 |
# File 'lib/twitterscraper/proxy.rb', line 23 def size @items.size end |