lib/progressbar.rb in progressbar-0.11.0 vs lib/progressbar.rb in progressbar-0.12.0
- old
+ new
@@ -8,11 +8,11 @@
# You can redistribute it and/or modify it under the terms
# of Ruby's license.
#
class ProgressBar
- VERSION = "0.11.0"
+ VERSION = "0.12.0"
def initialize (title, total, out = STDERR)
@title = title
@total = total
@out = out
@@ -26,9 +26,13 @@
@title_width = 14
@format = "%-#{@title_width}s %3d%% %s %s"
@format_arguments = [:title, :percentage, :bar, :stat]
clear
show
+ if block_given?
+ yield(self)
+ finish
+ end
end
attr_reader :title
attr_reader :current
attr_reader :total