batch 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,29 +51,3 @@ Installation
51
51
  ------------
52
52
 
53
53
  $ gem install batch
54
-
55
- License
56
- -------
57
-
58
- Copyright (c) 2010 Damian Janowski and Michel Martens
59
-
60
- Permission is hereby granted, free of charge, to any person
61
- obtaining a copy of this software and associated documentation
62
- files (the "Software"), to deal in the Software without
63
- restriction, including without limitation the rights to use,
64
- copy, modify, merge, publish, distribute, sublicense, and/or sell
65
- copies of the Software, and to permit persons to whom the
66
- Software is furnished to do so, subject to the following
67
- conditions:
68
-
69
- The above copyright notice and this permission notice shall be
70
- included in all copies or substantial portions of the Software.
71
-
72
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
73
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
74
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
75
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
76
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
77
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
78
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
79
- OTHER DEALINGS IN THE SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "batch"
3
- s.version = "1.0.0"
3
+ s.version = "1.0.1"
4
4
  s.summary = "Iterate Enumerables with progress reporting."
5
5
  s.authors = ["Damian Janowski", "Michel Martens"]
6
6
  s.email = ["djanowski@dimaion.com", "michel@soveran.com"]
@@ -65,6 +65,7 @@ class Batch
65
65
 
66
66
  def progress
67
67
  return unless @size
68
+ return 0 if @size == 0
68
69
 
69
70
  @current * 100 / @size
70
71
  end
@@ -95,4 +95,16 @@ EOS
95
95
 
96
96
  assert_equal expected.rstrip, stdout.rstrip
97
97
  end
98
+
99
+ should "work with empty enumerables" do
100
+ stdout, _ = capture do
101
+ Batch.each([]) { }
102
+ end
103
+
104
+ expected = <<-EOS
105
+ 0%
106
+ EOS
107
+
108
+ assert_equal expected.rstrip, stdout.rstrip
109
+ end
98
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: