progress_bar 1.0.2 → 1.0.3
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.
- checksums.yaml +4 -4
- data/lib/progress_bar.rb +4 -2
- data/lib/progress_bar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40985cca5f77a94078a72ab95f7b57e9f0404a9c
|
4
|
+
data.tar.gz: be48f2441f9b3810f186d1f7e02a406737fbcb8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08e3f5b64719f3d271b33f801bf15298922c9e34f2fb49452f173d96ef2c8434057465d98f9dbc918cb9c12996a472e13935fd3e892a833f8246e28c85962ba9
|
7
|
+
data.tar.gz: ec975577846e1793cb197af3f639446325b84e1ee5c50f1b7d4a0726cf60e37b306d89b96a8cc2e34ebde2301ba8ef9b1c65fadeb61bb4513c19be8468da185a
|
data/lib/progress_bar.rb
CHANGED
@@ -44,7 +44,7 @@ class ProgressBar
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def ratio
|
47
|
-
count.to_f / max
|
47
|
+
[count.to_f / max, 1.0].min # never go above 1, even if count > max
|
48
48
|
end
|
49
49
|
|
50
50
|
def percentage
|
@@ -127,7 +127,9 @@ class ProgressBar
|
|
127
127
|
|
128
128
|
def terminal_width
|
129
129
|
# HighLine check takes a long time, so only update width every second.
|
130
|
-
if @
|
130
|
+
if @terminal_width.nil? || @last_width_adjustment.nil? ||
|
131
|
+
::Time.now - @last_width_adjustment > 1
|
132
|
+
|
131
133
|
@last_width_adjustment = ::Time.now
|
132
134
|
@terminal_width = @hl.output_cols.to_i
|
133
135
|
if @terminal_width < 1
|
data/lib/progress_bar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: progress_bar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Sadauskas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: options
|