parallel 1.2.2 → 1.2.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -3
- data/lib/parallel.rb +10 -5
- data/lib/parallel/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4335cc7d93938d3aafdb07fee7a4aa32e7b586c7
|
4
|
+
data.tar.gz: 718327edc760a05b8d8502ed1afdb334a1fb1ef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d4c4d72297c1e8e0da33d05e111d7eb32e58c0f7d759329abd1c5f9a90c17711bf23202f75ad647414194284747b8d493073a11cc024e4351633a743526f6aa
|
7
|
+
data.tar.gz: 2dc97cc4d85eb122faa0cdade2de92d5889a14eed7fe08527c4cc3562d5fc8c2ae7571842a3c44bfc69fdb726aab5e19a90102a164a7884de93ac0291558df46
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
�{�3sA�e�{�yah�V�I�?+�b
|
1
|
+
]��� a��FmS%�Mϓh���u���M�m���BE��#��&.X��S�ၓ3�8aa�J~�>�巣�����=���n�D;{�EhMzsp�R��;���:�C�^Gώ����Y��&2��H4�~����"e�݈���O��1�ɖPtR
|
2
|
+
�!��$d�-�B��<�L�"�ȗ�Z{�c���ԃ�~�F/�'t"�brM�h��.9�k-5"o�� �a�|�kt\#9�xt�4�_е�����*�qI/�F
|
data/lib/parallel.rb
CHANGED
@@ -84,7 +84,7 @@ module Parallel
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def each(array, options={}, &block)
|
87
|
-
map(array, options.merge(:preserve_results =>
|
87
|
+
map(array, options.merge(:preserve_results => !!options[:finish]), &block)
|
88
88
|
array
|
89
89
|
end
|
90
90
|
|
@@ -94,6 +94,7 @@ module Parallel
|
|
94
94
|
|
95
95
|
def map(array, options = {}, &block)
|
96
96
|
array = array.to_a # turn Range and other Enumerable-s into an Array
|
97
|
+
options[:mutex] ||= Mutex.new
|
97
98
|
|
98
99
|
if RUBY_PLATFORM =~ /java/ and not options[:in_processes]
|
99
100
|
method = :in_threads
|
@@ -124,14 +125,18 @@ module Parallel
|
|
124
125
|
end
|
125
126
|
|
126
127
|
def add_progress_bar!(array, options)
|
127
|
-
if
|
128
|
+
if title = options[:progress]
|
128
129
|
require 'ruby-progressbar'
|
129
130
|
progress = ProgressBar.create(
|
130
131
|
:title => title,
|
131
132
|
:total => array.size,
|
132
133
|
:format => '%t |%E | %B | %a'
|
133
134
|
)
|
134
|
-
options[:finish]
|
135
|
+
old_finish = options[:finish]
|
136
|
+
options[:finish] = lambda do |item, i, result|
|
137
|
+
old_finish.call(item, i, result) if old_finish
|
138
|
+
progress.increment
|
139
|
+
end
|
135
140
|
end
|
136
141
|
end
|
137
142
|
|
@@ -442,10 +447,10 @@ module Parallel
|
|
442
447
|
def with_instrumentation(item, index, options)
|
443
448
|
on_start = options[:start]
|
444
449
|
on_finish = options[:finish]
|
445
|
-
on_start.call(item, index) if on_start
|
450
|
+
options[:mutex].synchronize { on_start.call(item, index) } if on_start
|
446
451
|
result = yield
|
447
452
|
ensure
|
448
|
-
on_finish.call(item, index, result) if on_finish
|
453
|
+
options[:mutex].synchronize { on_finish.call(item, index, result) } if on_finish
|
449
454
|
end
|
450
455
|
end
|
451
456
|
end
|
data/lib/parallel/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
F5etKHZg0j3eHO31/i2HnswY04lqGImUu6aM5EnijFTB7PPW2KwKKM4+kKDYFdlw
|
31
31
|
/0WV1Ng2/Y6qsHwmqGg2VlYj2h4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-08-
|
33
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
34
34
|
dependencies: []
|
35
35
|
description:
|
36
36
|
email: michael@grosser.it
|
metadata.gz.sig
CHANGED
Binary file
|