Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby/ProgressBar is a text progress bar library for Ruby.
Ruby
branch: master

This branch is 3 commits ahead, 634 commits behind jfelchner:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
GPL_LICENSE
README.md
RUBY_LICENSE
ruby-progressbar.gemspec
test.rb

README.md

ruby/progressbar

Ruby/ProgressBar is a text progress bar library for Ruby.

It can indicate progress with percentage, a progress bar, and estimated remaining time.

Documentation is available at rdoc.info

Examples

Basic functionality:

% 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

Set position directly:

>> 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

Block mode:

>> ProgressBar.block('test',100) do |pbar|
>>   100.times { sleep(0.1); pbar.inc }
>> end

Even simpler:

>> (1..100).to_a.each_with_progressbar('test') do
>>   sleep 0.1
>> end

Installation

gem install ruby-progressbar

Limitations

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.


Satoru Takabayashi

Cleaned up by Leonid Shevtsov

Something went wrong with that request. Please try again.