dispatch_queue 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,6 +6,8 @@ It was done for crawling things, but could be used in any case that you need to
6
6
 
7
7
  With this line, we get more documentation that real code, so please see the code.
8
8
 
9
+ [![Build Status](https://secure.travis-ci.org/guillermo/dispatch_queue.png)](http://travis-ci.org/guillermo/dispatch_queue)
10
+
9
11
 
10
12
  COMPATIBILITY
11
13
  =============
@@ -33,34 +35,29 @@ REALCODE
33
35
  =======
34
36
 
35
37
  ```ruby
36
- class DispatchQueue
37
- include Enumerable
38
-
39
- class << self
40
- alias :[] :new
41
- end
42
-
43
- def initialize(*array)
44
- @procs = array
45
- end
46
38
 
47
- def <<(new_one)
48
- @procs << new_one
49
- end
50
-
51
- def each
52
- @procs.map do |proc|
53
- Thread.new{ proc.call }
54
- end.map do |thread|
55
- yield thread.value
56
- end
39
+ class DispatchQueue
40
+ VERSION = "1.0.5"
41
+
42
+ def self.[](*procs)
43
+ procs.map { |proc|
44
+ Thread.new{ proc.to_proc.call }
45
+ }.map { |thread|
46
+ thread.value
47
+ }
57
48
  end
58
49
  end
59
50
 
60
51
 
61
52
  DQ = DispatchQueue
53
+
62
54
  ```
63
55
 
56
+ CHANGELOG
57
+ =========
58
+
59
+ * 1.0.5 Reduce implementation
60
+
64
61
  LICENSE
65
62
  =======
66
63
 
@@ -16,4 +16,5 @@ Gem::Specification.new do |s|
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.require_paths = ["lib"]
19
+ s.add_development_dependency "rake"
19
20
  end
@@ -1,25 +1,12 @@
1
1
  class DispatchQueue
2
- VERSION = "1.0.4"
3
- include Enumerable
4
-
5
- class << self
6
- alias :[] :new
7
- end
8
-
9
- def initialize(*array)
10
- @procs = array
11
- end
12
-
13
- def <<(new_one)
14
- @procs << new_one
15
- end
16
-
17
- def each
18
- @procs.map do |proc|
19
- Thread.new{ proc.call }
20
- end.map do |thread|
21
- yield thread.value
22
- end
2
+ VERSION = "1.0.5"
3
+
4
+ def self.[](*procs)
5
+ procs.map { |proc|
6
+ Thread.new{ proc.to_proc.call }
7
+ }.map { |thread|
8
+ thread.value
9
+ }
23
10
  end
24
11
  end
25
12
 
@@ -10,7 +10,4 @@ class DispatchQueueTest < Test::Unit::TestCase
10
10
  assert_equal [3,4], DQ[lambda{ sleep 0.1; 4}, lambda{ 3}].sort
11
11
  end
12
12
 
13
- def test_it_is_enumerable
14
- assert DQ.included_modules.include?(Enumerable)
15
- end
16
13
  end
metadata CHANGED
@@ -1,23 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dispatch_queue
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.4
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
5
  prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 5
10
+ version: 1.0.5
6
11
  platform: ruby
7
- authors:
8
- - Guillermo Álvarez
12
+ authors:
13
+ - "Guillermo A\xCC\x81lvarez"
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-08-08 00:00:00.000000000Z
13
- dependencies: []
17
+
18
+ date: 2011-09-08 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :development
33
+ version_requirements: *id001
14
34
  description: Little gem to enqueue jobs the easy way
15
- email:
35
+ email:
16
36
  - guillermo@cientifico.net
17
37
  executables: []
38
+
18
39
  extensions: []
40
+
19
41
  extra_rdoc_files: []
20
- files:
42
+
43
+ files:
21
44
  - .gitignore
22
45
  - Gemfile
23
46
  - README.md
@@ -25,29 +48,38 @@ files:
25
48
  - dispatch_queue.gemspec
26
49
  - lib/dispatch_queue.rb
27
50
  - test/test_dispatch_queue.rb
28
- homepage: ''
51
+ homepage: ""
29
52
  licenses: []
53
+
30
54
  post_install_message:
31
55
  rdoc_options: []
32
- require_paths:
56
+
57
+ require_paths:
33
58
  - lib
34
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
35
60
  none: false
36
- requirements:
37
- - - ! '>='
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
69
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
46
77
  requirements: []
78
+
47
79
  rubyforge_project: dispatch_queue
48
- rubygems_version: 1.8.7
80
+ rubygems_version: 1.8.10
49
81
  signing_key:
50
82
  specification_version: 3
51
83
  summary: Simple way to work enqueue works
52
- test_files:
84
+ test_files:
53
85
  - test/test_dispatch_queue.rb