peach 0.5 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ pkg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- peach (0.5)
4
+ peach (0.5.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,16 +1,9 @@
1
1
  # monkey patch Enumerable by reopening it. Enumerable.send(:include, Peach)
2
2
  # doesn't seem to work as it should.
3
- module Peach
4
- class EmptyThreadPoolError < RuntimeError
5
- end
6
- end
7
-
8
3
  module Enumerable
9
4
  def _peach_run(pool = nil, &b)
10
5
  pool ||= $peach_default_threads || count
11
- unless pool >= 1
12
- raise Peach::EmptyThreadPoolError, "Thread pool size less than one"
13
- end
6
+ pool = 1 unless pool >= 1
14
7
  div = (count/pool).to_i # should already be integer
15
8
  div = 1 unless div >= 1 # each thread better do something!
16
9
 
@@ -1,3 +1,3 @@
1
1
  module Peach
2
- VERSION = "0.5"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -10,13 +10,18 @@ class PeachTest < Test::Unit::TestCase
10
10
  normal_f = f.to_s[1..-1].to_sym
11
11
 
12
12
  setup do
13
- @data = [1, 2, 3, 5, 8]*10001
13
+ @data = [1, 2, 3, 5, 8]*1001
14
14
  @block = lambda{|i| i**2}
15
15
  end
16
16
  should "return the same result as #{normal_f}" do
17
17
  assert_equal @data.send(normal_f, &@block),
18
18
  @data.send(f, 100, &@block)
19
19
  end
20
+
21
+ should "return the same result as #{normal_f} for empty list" do
22
+ assert_equal [].send(normal_f, &@block),
23
+ [].send(f, nil, &@block)
24
+ end
20
25
  end
21
26
  end
22
27
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peach
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -49,6 +49,7 @@ executables: []
49
49
  extensions: []
50
50
  extra_rdoc_files: []
51
51
  files:
52
+ - .gitignore
52
53
  - Gemfile
53
54
  - Gemfile.lock
54
55
  - LICENSE
@@ -77,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
78
  version: '0'
78
79
  segments:
79
80
  - 0
80
- hash: 1425915303928506863
81
+ hash: 2784794470947016613
81
82
  required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  none: false
83
84
  requirements:
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
87
  version: '0'
87
88
  segments:
88
89
  - 0
89
- hash: 1425915303928506863
90
+ hash: 2784794470947016613
90
91
  requirements: []
91
92
  rubyforge_project:
92
93
  rubygems_version: 1.8.24