Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 GPL_LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 RUBY_LICENSE
Octocat-spinner-32 ruby-progressbar.gemspec
Octocat-spinner-32 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.