progress-meter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,9 +18,10 @@ class Progress
18
18
  #
19
19
  # If a description is given as a parameter it will show at the
20
20
  # beginning of the progress report.
21
- def Progress.monitor(desc = "")
21
+ def Progress.monitor(desc = "", num_reports = 100)
22
22
  @@monitor = true
23
23
  @@desc = desc
24
+ @@num_reports=num_reports
24
25
  end
25
26
 
26
27
  # Returns true if next loop must be monitored.
@@ -40,7 +41,7 @@ class Progress
40
41
  @current = 1
41
42
  @time = Time.now
42
43
  @last_report = 0
43
- @num_reports = 100
44
+ @num_reports = @@num_reports
44
45
  @depth = depth
45
46
  @desc = @@desc
46
47
  @@monitor = false
data/samples/hash-loop.rb CHANGED
@@ -10,7 +10,7 @@ h = Hash.new
10
10
  h[l] = l.upcase
11
11
  }
12
12
 
13
- Progress.monitor
13
+ Progress.monitor("hash",50)
14
14
  h.each{|d,u|
15
15
  puts "#{d} => #{u}, "
16
16
  sleep(0.2)
metadata CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: progress-meter
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2007-12-05 00:00:00 +01:00
8
- summary: Allows to monitor the progress of some loop. Currently only Array.each and Hash.each
6
+ version: 0.0.3
7
+ date: 2008-01-18 00:00:00 +01:00
8
+ summary: Allows to monitor the progress of some loop. Currently only Array.each, Array.collect and Hash.each
9
9
  require_paths:
10
10
  - lib
11
11
  email: mikisvaz@yahoo.com