lib/progress.rb in progress-0.0.4 vs lib/progress.rb in progress-0.0.5
- old
+ new
@@ -2,11 +2,11 @@
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
require 'singleton'
class Progress
- VERSION = '0.0.4'
+ VERSION = '0.0.5'
include Singleton
# start progress indication
# ==== Procedural example
@@ -27,15 +27,16 @@
# [1, 2, 3].each_with_progress('1 2 3') do |one_of_1_2_3|
# 10.times_with_progress('10') do |one_of_10|
# sleep(0.001)
# end
# end
- def self.start(name, total = 100)
+ def self.start(name, total = 1)
levels << new(name, total, levels.length)
print_message
if block_given?
- yield
+ result = yield
stop
+ result
end
end
def self.step(steps = 1)
levels[-1].step(steps)