philiprehberger-progress 0.5.0 → 0.6.0
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/CHANGELOG.md +5 -0
- data/README.md +4 -2
- data/lib/philiprehberger/progress/bar.rb +9 -1
- data/lib/philiprehberger/progress/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb855052746be6b7d6a120d7ad8b84ce16c8ccce47534463d04b698c680ea0fa
|
|
4
|
+
data.tar.gz: 2bf7bbafcf7feb5985c8baacc4a5eb10cbab3b5ee75f25d10a0512704230212a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b5e4769b17f4a50df8fba852ad7a9eddd1821207051bc1cd3011a2a1ef71afd2369ea6d984be789cb95be6a3e2271caf4872b32180d96ed63ddd0538956c9c1
|
|
7
|
+
data.tar.gz: c71135352b91900baa613bd2b2c87edd51d1992bd57ef586734b3328fd9fb44c330c2a1af8ecb2827f0b29ba7180860e453ffbe1abfc4e7e1a25142c811d5dc4
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.0] - 2026-05-07
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `Bar#remaining` — number of steps remaining (clamped to non-negative). Also added to `Bar#to_h`.
|
|
14
|
+
|
|
10
15
|
## [0.5.0] - 2026-04-14
|
|
11
16
|
|
|
12
17
|
### Added
|
data/README.md
CHANGED
|
@@ -116,7 +116,8 @@ Export the current state as a hash:
|
|
|
116
116
|
bar = Philiprehberger::Progress::Bar.new(total: 100)
|
|
117
117
|
50.times { bar.advance }
|
|
118
118
|
bar.to_h
|
|
119
|
-
# => { percentage: 50.0, elapsed: 1.2, eta: 1.2, throughput: 41.7, current: 50, total: 100 }
|
|
119
|
+
# => { percentage: 50.0, elapsed: 1.2, eta: 1.2, throughput: 41.7, current: 50, total: 100, remaining: 50 }
|
|
120
|
+
bar.remaining # => 50
|
|
120
121
|
```
|
|
121
122
|
|
|
122
123
|
### JSON Mode
|
|
@@ -186,7 +187,8 @@ multi.finished? # => true
|
|
|
186
187
|
| `#elapsed` | Elapsed time in seconds (excludes paused time) |
|
|
187
188
|
| `#eta` | Estimated time remaining in seconds |
|
|
188
189
|
| `#throughput` | Items per second |
|
|
189
|
-
| `#
|
|
190
|
+
| `#remaining` | Number of steps remaining (clamped to non-negative) |
|
|
191
|
+
| `#to_h` | Hash with `:percentage`, `:elapsed`, `:eta`, `:throughput`, `:current`, `:total`, `:remaining` |
|
|
190
192
|
| `#to_s` | Render the bar as a string (or JSON line in json_mode) |
|
|
191
193
|
|
|
192
194
|
### `Philiprehberger::Progress::Spinner`
|
|
@@ -103,6 +103,13 @@ module Philiprehberger
|
|
|
103
103
|
(@current.to_f / @total * 100).round(1)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
+
# Number of steps remaining (clamped to non-negative).
|
|
107
|
+
#
|
|
108
|
+
# @return [Integer]
|
|
109
|
+
def remaining
|
|
110
|
+
[@total - @current, 0].max
|
|
111
|
+
end
|
|
112
|
+
|
|
106
113
|
def elapsed
|
|
107
114
|
raw = now - @start_time - @pause_elapsed
|
|
108
115
|
raw -= (now - @pause_start) if @paused
|
|
@@ -132,7 +139,8 @@ module Philiprehberger
|
|
|
132
139
|
eta: eta,
|
|
133
140
|
throughput: throughput,
|
|
134
141
|
current: @current,
|
|
135
|
-
total: @total
|
|
142
|
+
total: @total,
|
|
143
|
+
remaining: remaining
|
|
136
144
|
}
|
|
137
145
|
end
|
|
138
146
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: philiprehberger-progress
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Philip Rehberger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Display progress bars with percentage, ETA, and throughput, or spinners
|
|
14
14
|
for indeterminate tasks. Supports block-based usage, enumerable iteration with each/map,
|