tansaku 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72b964910c8741df49ee30b329d6ca5e66d027699d83245f2c3a696ef53b3e8d
4
- data.tar.gz: 2e54b9307982714f2ca5d358d4452c6467547d063a6ccacfae965ab31ade4ff8
3
+ metadata.gz: e1df6b0d432754c0859695d783db4cbd51523593c787aa5e42cb8553003d1d9d
4
+ data.tar.gz: 48c390edf8d05445e2165845953852eee656a4e1e9d55aae005296e37e2d3f89
5
5
  SHA512:
6
- metadata.gz: 665e2c0947d74e408a210542f28470333db416f61054a07b8354f9b0a648016595238cb216b0dbb31373503308e35f14ba508c907265a9e48a13854408bb8a29
7
- data.tar.gz: b1cb664d64ab08584118d69536bc263333eefa92a7803ac2db08b81c64d68baf8dca7dbf69bfaca6525a5469b96cabee1075ad69e47744c33c45606518c61534
6
+ metadata.gz: bfa5f53b9e860efe887ad22d1bd419c97466bd9a42e589b6c8ef5540b9d87e518254eedca346c31b72e19d182b0180784a49e4ada9960919e173101e59deceee
7
+ data.tar.gz: 11af402ceafdad601111261d733a6a47c1377a8d1cbd2c2227918405580f23d7d3404c196227701af7c171518c1c6adb21dce3ebe30ddb246342d39a26733df8
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
- ---
2
1
  sudo: false
3
2
  language: ruby
4
3
  cache: bundler
5
4
  rvm:
6
5
  - 2.5.1
7
- before_install: gem install bundler -v 1.16.5
6
+ before_install: gem install bundler -v 1.17.1
data/lib/tansaku/cli.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "thor"
2
4
 
3
5
  require "json"
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "cgi"
4
4
  require "net/http"
5
- require "thread/pool"
5
+ require "parallel"
6
6
  require "uri"
7
7
 
8
8
  module Tansaku
@@ -31,16 +31,10 @@ module Tansaku
31
31
  end
32
32
 
33
33
  def crawl
34
- pool = Thread.pool(threads)
35
- results = []
36
- urls.each do |url|
37
- pool.process do
38
- results << url if online?(url)
39
- end
34
+ results = Parallel.map(urls, in_threads: threads) do |url|
35
+ url if online?(url)
40
36
  end
41
- pool.shutdown
42
-
43
- results
37
+ results.compact
44
38
  end
45
39
 
46
40
  private