tty-progressbar 0.18.0 → 0.18.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d266b064379d48a7f7efa620115e1de7d289d7d469f09ef3879cc1ccaceb71db
4
- data.tar.gz: 14ec207136b4910387f398f443351632e12c60744d389c1747a90ddf90cae5cd
3
+ metadata.gz: 7ce16ff1076a290596a04263c1fb09cd3246d4ea02e70a050405ee64c1b402e7
4
+ data.tar.gz: 7cd54ae7c051e037bad54b6992779bbd3afaeab89a112f9e9d1dd5f1bbeb0a11
5
5
  SHA512:
6
- metadata.gz: e872707b643d2b01f89fb056f31654f0d6aef50c9665936442c8c9f9cb8310f6bb8af447506d6ff3197284b4365595d475c799dc9d1c4dd20f0bc2d9fc395412
7
- data.tar.gz: d695aa270398d79899aea3dcaa58964f6f24ea8888d84cecbb191982cb52717b82526eeb92561ee50af1ec00e1ddba8d0b378c6d5484c8ed70e2e6890f0e07f4
6
+ metadata.gz: 04c89a52f0c7467b420419edb5841e52f5ce667b666cb8637aebf6295448598d6fbdd73874823d3b73df7fb38d633a7b94931c34356295dd812bb86cc55aa882
7
+ data.tar.gz: c8f65a47aa2258da3baceb42a146b528779e4b659031c2dd5dab33aba55d42673abcb885197112608a01c6147c4476d5bbdeea9db577a69478bf2f5aaa58cc91
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.18.1] - 2021-01-25
4
+
5
+ ### Fixed
6
+ * Fix :eta and :eta_time format tokens display when progress isn't started
7
+
3
8
  ## [v0.18.0] - 2021-01-20
4
9
 
5
10
  ### Added
@@ -232,6 +237,7 @@
232
237
 
233
238
  * Initial implementation and release
234
239
 
240
+ [v0.18.1]: https://github.com/piotrmurach/tty-progressbar/compare/v0.18.0...v0.18.1
235
241
  [v0.18.0]: https://github.com/piotrmurach/tty-progressbar/compare/v0.17.0...v0.18.0
236
242
  [v0.17.0]: https://github.com/piotrmurach/tty-progressbar/compare/v0.16.0...v0.17.0
237
243
  [v0.16.0]: https://github.com/piotrmurach/tty-progressbar/compare/v0.15.1...v0.16.0
@@ -18,13 +18,15 @@ module TTY
18
18
  #
19
19
  # @api public
20
20
  def call(value)
21
- if @progress.indeterminate?
21
+ if @progress.indeterminate? ||
22
+ (@progress.elapsed_time.zero? && @progress.ratio.zero?)
22
23
  return value.gsub(matcher, "--s")
23
24
  end
24
25
 
25
26
  elapsed = @progress.elapsed_time
26
- estimated = (elapsed / @progress.ratio).to_f - elapsed
27
- estimated = (estimated.infinite? || estimated < 0) ? 0.0 : estimated
27
+ estimated = @progress.ratio.zero? ? 0.0 : (elapsed / @progress.ratio).to_f
28
+ estimated -= elapsed
29
+ estimated = 0.0 if estimated < 0
28
30
  value.gsub(matcher, Converter.to_time(estimated))
29
31
  end
30
32
  end # EstimatedFormatter
@@ -15,13 +15,15 @@ module TTY
15
15
  #
16
16
  # @api public
17
17
  def call(value)
18
- if @progress.indeterminate?
18
+ if @progress.indeterminate? ||
19
+ (@progress.elapsed_time.zero? && @progress.ratio.zero?)
19
20
  return value.gsub(matcher, "--:--:--")
20
21
  end
21
22
 
22
23
  elapsed = @progress.elapsed_time
23
- estimated = (elapsed / @progress.ratio).to_f - elapsed
24
- estimated = (estimated.infinite? || estimated < 0) ? 0.0 : estimated
24
+ estimated = @progress.ratio.zero? ? 0.0 : (elapsed / @progress.ratio).to_f
25
+ estimated -= elapsed
26
+ estimated = 0.0 if estimated < 0
25
27
 
26
28
  time_format = if estimated >= 86_400 # longer than a day
27
29
  "%Y-%m-%d %H:%M:%S"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  class ProgressBar
5
- VERSION = "0.18.0"
5
+ VERSION = "0.18.1"
6
6
  end # ProgressBar
7
7
  end # TTY
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-progressbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: strings-ansi