index:Ej
Last Modified: 2005-05-22 00:28:04
--
Ruby/ProgressBar is a text progress bar library for Ruby. It can indicate progress with percentage, a progress bar, and estimated remaining time.
The latest version of Ruby/ProgressBar is available at <URL:http://namazu.org/~satoru/ruby-progressbar/> .
% irb --simple-prompt -r progressbar >> pbar = ProgressBar.new("test", 100) => (ProgressBar: 0/100) >> 100.times {sleep(0.1); pbar.inc}; pbar.finish test: 100% |oooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10 => nil >> pbar = ProgressBar.new("test", 100) => (ProgressBar: 0/100) >> (1..100).each{|x| sleep(0.1); pbar.set(x)}; pbar.finish test: 67% |oooooooooooooooooooooooooo | ETA: 00:00:03
ProgressBar#new (title, total, out = STDERR)
Display the initial progress bar and return a ProgressBar object. title specifies the title, and total specifies the total cost of processing. Optional parameter out specifies the output IO.
The display of the progress bar is updated when one or more percent is proceeded or one or more seconds are elapsed from the previous display.
ProgressBar#inc (step = 1)
ProgressBar#set (count)
ProgressBar#finish
ProgressBar#halt
ProgressBar#format=
ProgressBar#format_arguments=
ProgressBar#file_transfer_mode
ReverseProgressBar class is also available. The functionality is identical to ProgressBar but the direction of the progress bar is just opposite.
Since the progress is calculated by the proportion to the total cost of processing, Ruby/ProgressBar cannot be used if the total cost of processing is unknown in advance. Moreover, the estimation of remaining time cannot be accurately performed if the progress does not flow uniformly.
Ruby/ProgressBar is a free software with ABSOLUTELY NO WARRANTY under the terms of Ruby's license.
--