celluloid-pmap 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/celluloid/pmap.rb +13 -10
- data/lib/celluloid/pmap/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d404e2a44d975c5b639686046da023dc4d30d5
|
4
|
+
data.tar.gz: c2067ad8a50a51fd558df6b3f79b5beca60e8fab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41a73af9b13aaece19cd930f24017c1c610b142aa72bfcfb9ac4e9d82ef07a1ad6e78834230ac6bfabaab0314d94f4171e6c0f1a0615155b108576f9f0a226c8
|
7
|
+
data.tar.gz: 50cecb0d475e0a65e444fb00563fa384528e2b7e1a0bb0c7e82d4f8904ea54be499d6518b0fe05cd682c305bdf729c2a7f721898fbf42f13b168c185bc8bec49
|
data/lib/celluloid/pmap.rb
CHANGED
@@ -4,27 +4,30 @@ require "celluloid/pmap/version"
|
|
4
4
|
module Celluloid
|
5
5
|
module Pmap
|
6
6
|
|
7
|
-
|
7
|
+
def self.find_loaded_gem(name)
|
8
|
+
Gem.loaded_specs.values.detect{|repo| repo.name == name }
|
9
|
+
end
|
10
|
+
|
8
11
|
def self.pool_class
|
9
|
-
celluloid_version =
|
10
|
-
if celluloid_version[0].to_i
|
12
|
+
celluloid_version = find_loaded_gem("celluloid").version.to_s.split('.')
|
13
|
+
if celluloid_version[0].to_i == 0 && celluloid_version[1].to_i <= 16
|
11
14
|
require 'celluloid'
|
12
15
|
Celluloid::PoolManager
|
13
16
|
else
|
14
|
-
|
17
|
+
require 'celluloid/current'
|
15
18
|
Celluloid::Supervision::Container::Pool
|
16
|
-
end
|
19
|
+
end
|
17
20
|
end
|
18
|
-
|
21
|
+
|
19
22
|
def self.included(base)
|
20
23
|
base.class_eval do
|
21
24
|
|
22
25
|
def pmap(pool_or_size=Celluloid.cores, &block)
|
23
26
|
pool = if pool_or_size.class.ancestors.include?(Celluloid::Pmap.pool_class)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
pool_or_size
|
28
|
+
else
|
29
|
+
Pmap::ParallelMapWorker.pool(size: pool_or_size)
|
30
|
+
end
|
28
31
|
futures = map { |elem| pool.future(:yielder, elem, block) }
|
29
32
|
futures.map { |future| future.value }
|
30
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid-pmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Wolgamott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.4.5
|
111
|
+
rubygems_version: 2.4.5.1
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: 'Celluloid Futures are wicked sweet, and when combined with a #pmap implementation
|
@@ -118,4 +118,3 @@ test_files:
|
|
118
118
|
- spec/celluloid/pmap_spec.rb
|
119
119
|
- spec/spec_helper.rb
|
120
120
|
- spec/support/benchmark_spec.rb
|
121
|
-
has_rdoc:
|