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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87801c95ee0b65e7efad886c800f8e0c5ce4cb15
4
- data.tar.gz: 83e083290f31ddb16d8e0f3ee7098d44700b1de6
3
+ metadata.gz: d1d404e2a44d975c5b639686046da023dc4d30d5
4
+ data.tar.gz: c2067ad8a50a51fd558df6b3f79b5beca60e8fab
5
5
  SHA512:
6
- metadata.gz: d8931423cd0d9e6f03bf86aa2163f1162f82a33a41e3d8bc8f60af1906429b8d75523ee59082099c294b8f8e45c4e45d89689a899ef3eef37911bb46ee5a6577
7
- data.tar.gz: 73b1e7e226d57b2a35a4d48977bc15b9b483c9ec332c6e2adbab38fa5409f9c1fbb5386fcb7b6c07d2c2658b6586378a8901ae0870a714a9bd13e742ec50adc1
6
+ metadata.gz: 41a73af9b13aaece19cd930f24017c1c610b142aa72bfcfb9ac4e9d82ef07a1ad6e78834230ac6bfabaab0314d94f4171e6c0f1a0615155b108576f9f0a226c8
7
+ data.tar.gz: 50cecb0d475e0a65e444fb00563fa384528e2b7e1a0bb0c7e82d4f8904ea54be499d6518b0fe05cd682c305bdf729c2a7f721898fbf42f13b168c185bc8bec49
@@ -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 = Celluloid::VERSION.to_s.split('.')
10
- if celluloid_version[0].to_i >= 0 && celluloid_version[1].to_i <= 16
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
- require 'celluloid/current'
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
- pool_or_size
25
- else
26
- Pmap::ParallelMapWorker.pool(size: pool_or_size)
27
- end
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
@@ -1,5 +1,5 @@
1
1
  module Celluloid
2
2
  module Pmap
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  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.1
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-08-11 00:00:00.000000000 Z
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: