progress 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/lib/progress.rb +11 -5
- metadata +2 -2
data/History.txt
CHANGED
data/lib/progress.rb
CHANGED
@@ -4,7 +4,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
4
4
|
require 'singleton'
|
5
5
|
|
6
6
|
class Progress
|
7
|
-
VERSION = '0.0.
|
7
|
+
VERSION = '0.0.4'
|
8
8
|
|
9
9
|
include Singleton
|
10
10
|
|
@@ -17,6 +17,12 @@ class Progress
|
|
17
17
|
# Progress.start('Test', 1000) do
|
18
18
|
# 1000.times{ Progress.step }
|
19
19
|
# end
|
20
|
+
# ==== Step must not always be one
|
21
|
+
# Progress.start('Test', 10) do
|
22
|
+
# (1..10).to_a.each_slice do |slice|
|
23
|
+
# Progress.step(slice.length)
|
24
|
+
# end
|
25
|
+
# end
|
20
26
|
# ==== Enclosed block example
|
21
27
|
# [1, 2, 3].each_with_progress('1 2 3') do |one_of_1_2_3|
|
22
28
|
# 10.times_with_progress('10') do |one_of_10|
|
@@ -32,8 +38,8 @@ class Progress
|
|
32
38
|
end
|
33
39
|
end
|
34
40
|
|
35
|
-
def self.step
|
36
|
-
levels[-1].step
|
41
|
+
def self.step(steps = 1)
|
42
|
+
levels[-1].step(steps)
|
37
43
|
print_message
|
38
44
|
end
|
39
45
|
|
@@ -58,8 +64,8 @@ class Progress
|
|
58
64
|
self.message = '.' * 6
|
59
65
|
end
|
60
66
|
|
61
|
-
def step # :nodoc:
|
62
|
-
@current +=
|
67
|
+
def step(steps) # :nodoc:
|
68
|
+
@current += steps
|
63
69
|
self.message = percent
|
64
70
|
end
|
65
71
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: progress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-06 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|