title_grabber 0.2.0 → 0.2.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: 96fbc07b812b570e0827c2d6b7b2d18f7b9ad0b4a172b69606648bb21d7e41b6
4
- data.tar.gz: 72c04ad3f1149e44bc0a16a8e7d6c0c5d13be794e026c3748415f96197c5d146
3
+ metadata.gz: 783d760ffd64b911ce9b869e81e9eecb471728e6eb1f147cfb0352cda18ccff9
4
+ data.tar.gz: 9894f60bd6eff8e73ca2a2b45a87483e69d39f4beeccbcaf7ae050b9f8e38b12
5
5
  SHA512:
6
- metadata.gz: c88bdf88fe2dd0bce4bde4ad97d5432e7d5433a4a581372c938500fa7323d0020437c5326e19e3f7248cebe02123c93dfd00cb498669ae363a33d2267f28f90f
7
- data.tar.gz: f9901cb587973ed762a2ad100e9410819a36dfe34e61c54daac78ad6ff72284faeddcd1f8f27594c25467622e3882670473931367d43efa68a026e7151f2bba8
6
+ metadata.gz: 071b788b02f27cf5bad8f54d34d4cf0f8483e71d9445eb920e9eb9e22896b2c548489ce0bb6663757c0db55ca6e0f3340aa95de67fc33bb1c92f87177d45a62e
7
+ data.tar.gz: d046603d9903f163b9fd6230b9dead31ba3bd8c64d57246892843903df1cdceaa312bea43f35029e0b0a9c624eb358a87267d4cb60fc902164d41ac20bcafc74
@@ -1,3 +1,3 @@
1
1
  module TitleGrabber
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/title_grabber.rb CHANGED
@@ -23,11 +23,10 @@ module TitleGrabber
23
23
  include TextHelper
24
24
 
25
25
  def call(lines, options)
26
- tmp_path = nil
27
- processed_urls = if (out_path = options[:output]).exist?
28
- tmp_path = out_path.sub_ext(".tmp#{out_path.extname}")
29
- FileUtils.cp(out_path, tmp_path)
30
- arr_of_h = CSV.read(tmp_path, headers: true)
26
+ out_path = options[:output]
27
+
28
+ processed_urls = if out_path.exist?
29
+ arr_of_h = CSV.read(out_path, headers: true)
31
30
  arr_of_h.each_with_object({}) { |r, h|
32
31
  page_tit = r[PAGE_TIT_HEAD]
33
32
  art_tit = r[ART_TIT_HEAD]
@@ -45,7 +44,8 @@ module TitleGrabber
45
44
 
46
45
  queue = Queue.new
47
46
 
48
- CSV.open(options[:output], "w", force_quotes: true) do |csv|
47
+ tmp_path = out_path.sub_ext(".tmp#{out_path.extname}")
48
+ CSV.open(tmp_path, "w", force_quotes: true) do |csv|
49
49
  csv << HEADERS
50
50
 
51
51
  lines.each do |line|
@@ -89,7 +89,7 @@ module TitleGrabber
89
89
  }.each(&:join)
90
90
  end
91
91
 
92
- tmp_path&.unlink
92
+ FileUtils.mv(tmp_path, out_path)
93
93
  end
94
94
  end
95
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: title_grabber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristian Rasch