File: progressbar.en.rd

package info (click to toggle)
libprogressbar-ruby 0.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 40 kB
  • ctags: 17
  • sloc: ruby: 112; makefile: 44
file content (68 lines) | stat: -rw-r--r-- 2,339 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
=begin
= Ruby/ProgressBar: A Text Progress Bar Library for Ruby

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/>))
.

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

== Examples

  % 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

== API

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

--- ProgressBar#inc (step = 1)
    Increase the internal counter by ((|step|)) and update
    the display of the progress bar. Display the estimated
    remaining time on the right side of the bar. The counter
    does not go beyond the ((|total|)).

--- ProgressBar#set (count)
    Set the internal counter to ((|count|)) and update the
    display of the progress bar. Display the estimated
    remaining time on the right side of the bar.  Raise if
    ((|count|)) is a negative number or a number more than
    the ((|total|)).

--- ProgressBar#finish
    Stop the progress bar and update the display of progress
    bar. Display the elapsed time on the right side of the bar.

== Download

Ruby/ProgressBar is a free software with ABSOLUTELY NO WARRANTY
under the terms of Ruby's license.

  * ((<URL:http://namazu.org/~satoru/ruby-progressbar/ruby-progressbar-0.2.tar.gz>))
  * ((<URL:http://cvs.namazu.org/ruby-progressbar/>))

satoru@namazu.org
=end