creeker 2.1.3 → 2.1.4

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
  SHA1:
3
- metadata.gz: 90abfebb786387b1b3263bd1c3f42f6008838321
4
- data.tar.gz: b5cebc6dc4073c4106e7dd6199b2437ed21aee25
3
+ metadata.gz: f0d255dd9727f3364bfadcdf12a21dfc3ae72595
4
+ data.tar.gz: de0f8ef51a9b7f67ae336935981ec9c20c885c1f
5
5
  SHA512:
6
- metadata.gz: 22b01bbc8bea7cfa6c959dcf40183eea7ac5a2b92a9386f8f19ec211394cd55c693a094aafd2a0f756ac202a9d0482e78d27cf82d42ed5a0a308d0fc55f71543
7
- data.tar.gz: 88ec7a6283451313aebc0a033dadfade51d3d1f91bae73417ddfafb8bf552cb70f31701de6da46dede61b6800242348572b82d08f9209acd25b51b7acfb82fbd
6
+ metadata.gz: 53ef6ad9fb7b60abd8dcebe5e1e561f941d2788a866b5c713abfc0dccf262c64d04b30a8492fe548cd134e1c2c65b6d604f8dcdf5d1ec300aeadacccc18e47ef
7
+ data.tar.gz: ec29a6a56281298b7dcb0c7cfc1b3385108b9093b34a578dc9d9e40e4e6a00bbfd2e8ce02f6224231fdeedd54ffba65b5ef130db50e6dbe17c0ed9e53138b6cb
data/.DS_Store CHANGED
Binary file
@@ -9,24 +9,23 @@ module Creeker
9
9
 
10
10
  def initialize book, multi_thread = false
11
11
  @book = book
12
- @multi_thread = multi_thread
13
- parse_shared_shared_strings
12
+ parse_shared_shared_strings(multi_thread)
14
13
  end
15
14
 
16
- def parse_shared_shared_strings
15
+ def parse_shared_shared_strings multi_thread
17
16
  path = "xl/sharedStrings.xml"
18
17
  if @book.files.file.exist?(path)
19
18
  doc = @book.files.file.open path
20
19
  xml = Nokogiri::XML::Document.parse doc
21
- parse_shared_string_from_document(xml)
20
+ parse_shared_string_from_document(xml, multi_thread)
22
21
  end
23
22
  end
24
23
 
25
- def parse_shared_string_from_document(xml)
26
- @dictionary = self.class.parse_shared_string_from_document(xml)
24
+ def parse_shared_string_from_document(xml, multi_thread)
25
+ @dictionary = self.class.parse_shared_string_from_document(xml, multi_thread)
27
26
  end
28
27
 
29
- def self.parse_shared_string_from_document(xml)
28
+ def self.parse_shared_string_from_document(xml, multi_thread)
30
29
  dictionary = Hash.new
31
30
  # (1..10).each do |i|
32
31
  # thread = Thread.new do
@@ -45,8 +44,8 @@ module Creeker
45
44
  # end
46
45
 
47
46
  # Creeker::Book.new(Upload.last.document.path)
48
- if @multi_thread
49
- xml.css('si').to_a.in_groups_of(10000).each do |group|
47
+ if multi_thread
48
+ xml.css('si').to_a.in_groups_of(10000).each_with_index do |group, index|
50
49
  thread = Thread.new do
51
50
  group.each_with_index do |si, idx|
52
51
  text_nodes = si.css('t')
@@ -58,7 +57,7 @@ module Creeker
58
57
  end
59
58
  end
60
59
 
61
- # sleep 5
60
+ sleep index
62
61
  GC.start
63
62
  end
64
63
  else
@@ -70,6 +69,8 @@ module Creeker
70
69
  dictionary[idx] = text_nodes.map(&:content).join('')
71
70
  end
72
71
  end
72
+ sleep 1
73
+ GC.start
73
74
  end
74
75
  dictionary
75
76
  end
@@ -1,3 +1,3 @@
1
1
  module Creeker
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creeker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - huntcode