proxy_manager 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1785202317778f2e76f7b1aac4471fb54f6f5d52
4
- data.tar.gz: 426b4b2c92c5832bcad06f526eedce5652c47b12
3
+ metadata.gz: 35ab032dab45fa2d252c021a447b8f46851b23ee
4
+ data.tar.gz: 25bde6a799ef93b589c66f68af8b139cc7feb716
5
5
  SHA512:
6
- metadata.gz: 268c1fa55e8888ce349b6bb7725e79e20e81c3dfb5032eb9a3cc5446e0462be1cd253eb9f2708b85ceb91261aa0178b519251b30534ee5eddbac86ec446b920c
7
- data.tar.gz: 8e89bf5bd2ae7a59f8e9d554af05ee22712793f4bf0c71bc48b1844a21cd7ef87ee4269da2365a78a5e0da037e13a273cbdeab28b98738027723fe4fcab23080
6
+ metadata.gz: 39f55eee88c8afbbc1e817e84a34c146473e02cad1b7ecb92a72bc476535bc1035ecd7dbbf6ed4785f4a7b2eec093c059b5846039dccde1e357eb0916dbf826f
7
+ data.tar.gz: 3818128cf8fb8040a5d362c67a153a9eee5c951ceaaf3be1b16c2227c52ef7cf8de6bd213414ed61635cae2c17661d4a180c7af3351d9e3ffa93ae24c9e82135
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- proxy_manager (0.0.7)
4
+ proxy_manager (0.0.8)
5
5
  net-ping (~> 1.7, >= 1.7.2)
6
6
 
7
7
  GEM
@@ -16,6 +16,7 @@ module ProxyManager
16
16
  @list_file, @bad_list_file = proxies, bad_proxies
17
17
 
18
18
  load_list_from_file(proxies)
19
+ load_bad_list_from_file(bad_proxies)
19
20
  end
20
21
  end
21
22
 
@@ -28,12 +29,13 @@ module ProxyManager
28
29
  raise 'List is empty' if @list.empty?
29
30
 
30
31
  items = []
32
+ new_list = @list.clone
31
33
 
32
34
  @list.each_with_index do |proxy, key|
33
- @list.delete_at(key)
35
+ new_list.shift
34
36
 
35
37
  if connectable? proxy
36
- @list << proxy
38
+ new_list << proxy
37
39
 
38
40
  if count == 1
39
41
  items = proxy
@@ -47,6 +49,8 @@ module ProxyManager
47
49
  end
48
50
  end
49
51
 
52
+ @list = new_list
53
+
50
54
  raise 'There are no available proxy' if items.empty?
51
55
 
52
56
  if @list_file && @bad_list_file
@@ -90,5 +94,14 @@ module ProxyManager
90
94
  end
91
95
  end
92
96
  end
97
+
98
+ def load_bad_list_from_file(bad_proxies)
99
+ File.open(bad_proxies, "r").each do |line|
100
+ line = line.chomp.split(':')
101
+ if line[0].is_a? String and line[1].is_a? String
102
+ @bad_list << [line[0], line[1].to_i]
103
+ end
104
+ end
105
+ end
93
106
  end
94
107
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
  # Describe your gem and declare its dependencies:
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "proxy_manager"
6
- s.version = '0.0.8'
6
+ s.version = '0.0.9'
7
7
  s.authors = ["Kirill Platonov"]
8
8
  s.licenses = ['MIT']
9
9
  s.email = ["platonov.kd@gmail.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Platonov