progress 0.1.0.0 → 0.1.0.1
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/VERSION.yml +1 -1
- data/lib/progress.rb +6 -5
- data/progress.gemspec +1 -1
- metadata +1 -1
data/VERSION.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
[0, 1, 0,
|
1
|
+
[0, 1, 0, 1]
|
data/lib/progress.rb
CHANGED
@@ -9,15 +9,16 @@ class Progress
|
|
9
9
|
module InstanceMethods # :nodoc:
|
10
10
|
attr_accessor :title, :current, :total
|
11
11
|
def initialize(title, total)
|
12
|
-
|
12
|
+
total = Float(total)
|
13
|
+
@title, @current, @total = title, 0.0, total == 0.0 ? 1.0 : total
|
13
14
|
end
|
14
15
|
|
15
16
|
def step_if_blank
|
16
|
-
self.current = 1 if current == 0 && total == 1
|
17
|
+
self.current = 1.0 if current == 0.0 && total == 1.0
|
17
18
|
end
|
18
19
|
|
19
20
|
def to_f(inner)
|
20
|
-
(current +
|
21
|
+
(current + (inner < 1.0 ? inner : 1.0)) / total
|
21
22
|
end
|
22
23
|
end
|
23
24
|
include InstanceMethods
|
@@ -62,12 +63,12 @@ class Progress
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def step(steps = 1)
|
65
|
-
levels.last.current += steps
|
66
|
+
levels.last.current += Float(steps)
|
66
67
|
print_message
|
67
68
|
end
|
68
69
|
|
69
70
|
def set(value)
|
70
|
-
levels.last.current = value
|
71
|
+
levels.last.current = Float(value)
|
71
72
|
print_message
|
72
73
|
end
|
73
74
|
|
data/progress.gemspec
CHANGED