File: test.rb

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 (29 lines) | stat: -rw-r--r-- 520 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
require 'progressbar'

total = 100
pbar = ProgressBar.new("test(inc)", total)
total.times {
  sleep(0.1)
  pbar.inc
}
pbar.finish

total = 1000
pbar = ProgressBar.new("test(set)", total)
(1..total).find_all {|x| x % 10 == 0}.each {|x|
  sleep(0.1)
  pbar.set(x)
}
pbar.finish

total = File.size("progressbar.rb")
pbar = ProgressBar.new("test(inc(x))", total)
File.new("progressbar.rb").each {|line|
  sleep(0.1)
  pbar.inc(line.length)
}
pbar.finish

total = 0
pbar = ProgressBar.new("test(total=0)", total)
pbar.finish