Sha256: 94b354c0f7ec6f2ea4c1e5554d301ac9f0ce27bd1a803df41c2995b1feb532c3

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

# ProgressBar

*ProgressBar* is a simple Ruby library for displaying progress of
long-running tasks on the console. It is intended to be easy to use
first, and configurable for additional needs.

# Installation

    gem install progress_bar

# Examples

## The Easy Way


    require 'progress_bar'
    bar = ProgressBar.new

    100.times do
      sleep 0.1
      bar.increment!
    end

Produces output like:

    [#######################################                           ] [ 59.00%] [00:06]

*Note: It may not be exactly like this. I might have changed the default
meters between now and when I wrote this readme, and forgotten to update
it.*

## Setting the Max

Usually, the defaults should be fine, the only thing you'll need to
tweak is the max.

    bar = ProgressBar.new(1000)

## Larger Steps

If you want to process several things, and update less often, you can
pass a number to `#increment!`

    bar.increment! 42

## The Configurable Way

    bar = ProgressBar.new do |cfg|
      cfg.width = 60
      cfg.max   = 1000
      cfg.color = true
      cfg.meters = [:bar, :eta]

      cfg.bar.width = 40
      cfg.bar.fill = '#'
      cfg.bar.empty = ' '
      cfg.bar.prefix = '['
      cfg.bar.suffix = ']'

      cfg.eta.format = "%H:%M:%S"
    end





Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
progress_bar-0.3.0 README.mkd
progress_bar-0.2.0 README.mkd
progress_bar-0.1.0 README.mkd