progress 0.1.0.1 → 0.1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- [0, 1, 0, 1]
1
+ [0, 1, 0, 2]
@@ -63,19 +63,25 @@ class Progress
63
63
  end
64
64
 
65
65
  def step(steps = 1)
66
- levels.last.current += Float(steps)
67
- print_message
66
+ if levels.last
67
+ levels.last.current += Float(steps)
68
+ print_message
69
+ end
68
70
  end
69
71
 
70
72
  def set(value)
71
- levels.last.current = Float(value)
72
- print_message
73
+ if levels.last
74
+ levels.last.current = Float(value)
75
+ print_message
76
+ end
73
77
  end
74
78
 
75
79
  def stop
76
- print_message if levels.last.step_if_blank
77
- levels.pop
78
- io.puts if levels.empty?
80
+ if levels.last
81
+ print_message if levels.last.step_if_blank
82
+ levels.pop
83
+ io.puts if levels.empty?
84
+ end
79
85
  end
80
86
 
81
87
  attr_writer :io, :lines, :highlight # :nodoc:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{progress}
5
- s.version = "0.1.0.1"
5
+ s.version = "0.1.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["toy"]
@@ -171,6 +171,20 @@ describe Progress do
171
171
  end.should == 'qwerty'
172
172
  end
173
173
 
174
+ it "should not raise errors on extra Progress.stop" do
175
+ proc{
176
+ 10.times_with_progress('10') do
177
+ Progress.start 'simple' do
178
+ Progress.start 'procedural'
179
+ Progress.stop
180
+ Progress.stop
181
+ end
182
+ Progress.stop
183
+ end
184
+ Progress.stop
185
+ }.should_not raise_error
186
+ end
187
+
174
188
  it "should pipe result from nested block" do
175
189
  [1, 2, 3].with_progress('a').map do |a|
176
190
  [1, 2, 3].with_progress('b').map do |b|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.1
4
+ version: 0.1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - toy