lib/progress.rb in progress-1.0.0 vs lib/progress.rb in progress-1.0.1
- old
+ new
@@ -83,23 +83,25 @@
stop
end
end
end
- def step(steps = 1, &block)
+ def step(num = 1, den = 1, &block)
if levels.last
- set(levels.last.current + Float(steps), &block)
+ set(levels.last.current + Float(num) / den, &block)
elsif block
block.call
end
end
def set(value, &block)
if levels.last
ret = if block
levels.last.step(value - levels.last.current, &block)
end
- levels.last.current = Float(value)
+ if levels.last
+ levels.last.current = Float(value)
+ end
print_message
ret
elsif block
block.call
end