parallel2 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +1 -0
- data/lib/parallel2.rb +27 -0
- data/parallel2.gemspec +14 -0
- metadata +60 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Bryan Goines
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
data/lib/parallel2.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'celluloid'
|
2
|
+
|
3
|
+
|
4
|
+
class Parallel
|
5
|
+
|
6
|
+
def self.each(collection, &block)
|
7
|
+
klass = new(collection, &block)
|
8
|
+
klass.parallelized_each(&block)
|
9
|
+
collection
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(collection, &block)
|
13
|
+
@collection = collection
|
14
|
+
@block = block
|
15
|
+
end
|
16
|
+
|
17
|
+
def parallelized_each(&block)
|
18
|
+
futures.each(&:value)
|
19
|
+
end
|
20
|
+
|
21
|
+
def futures
|
22
|
+
@futures ||= @collection.map do |item|
|
23
|
+
Celluloid::Future.new(item, &@block)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/parallel2.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "parallel2"
|
7
|
+
gem.version = "0.1.0"
|
8
|
+
gem.author = "Bryan Goines"
|
9
|
+
gem.summary = "Parallel #each using Celluloid::Future"
|
10
|
+
gem.email = "bryann83@gmail.com"
|
11
|
+
gem.homepage = "https://github.com/bry4n/parallel2"
|
12
|
+
gem.files = Dir['**/*']
|
13
|
+
gem.add_dependency "celluloid", "0.10.0"
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: parallel2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bryan Goines
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: celluloid
|
16
|
+
requirement: &70129727674940 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - =
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.10.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70129727674940
|
25
|
+
description:
|
26
|
+
email: bryann83@gmail.com
|
27
|
+
executables: []
|
28
|
+
extensions: []
|
29
|
+
extra_rdoc_files: []
|
30
|
+
files:
|
31
|
+
- Gemfile
|
32
|
+
- lib/parallel2.rb
|
33
|
+
- LICENSE
|
34
|
+
- parallel2.gemspec
|
35
|
+
- README.md
|
36
|
+
homepage: https://github.com/bry4n/parallel2
|
37
|
+
licenses: []
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 1.8.11
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: ! 'Parallel #each using Celluloid::Future'
|
60
|
+
test_files: []
|