philiprehberger-progress 0.3.0 → 0.4.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 +12 -16
- data/README.md +3 -0
- data/lib/philiprehberger/progress/bar.rb +22 -0
- data/lib/philiprehberger/progress/spinner.rb +1 -1
- data/lib/philiprehberger/progress/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9d1ecb051d55213a818343c3133c067129bf55e65b6677a2efb9be49c249ab5b
|
|
4
|
+
data.tar.gz: '0039452f607ef4f9fe1f1a1098b31039c6ea7ecbc9c0618c8f8fba78b5464763'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da6edc69bcc8dc77d091ba848dae89fb8f8e5054ceb1f9c6991537e85554b8a3bbde4cef23b94089d0c6194827ae6c13e3a7cb02f875d9d7ca9e3960519d7023
|
|
7
|
+
data.tar.gz: 5692a7b42fb906e3234117a3a96ca0ad2c1af88d558bc41e7a787cd8c1cc954a5c317613b91ff8d913b27b87263ea279d8bf497b19f17886cf57c8141578b6f8
|
data/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this gem will be documented in this file.
|
|
4
4
|
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.
|
|
6
|
-
and this
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0] - 2026-04-09
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `Bar#set(n)` to set absolute progress position
|
|
14
|
+
- `Bar#reset` to restart the bar from 0, preserving configuration
|
|
15
|
+
- `Spinner#message=` to update the spinner message dynamically
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Standardize CHANGELOG header format to match template
|
|
19
|
+
|
|
10
20
|
## [0.3.0] - 2026-04-09
|
|
11
21
|
|
|
12
22
|
### Added
|
|
@@ -92,17 +102,3 @@ and this gem adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
92
102
|
- `Progress.spin` convenience method with block support
|
|
93
103
|
- `Progress.each` for iterating enumerables with progress display
|
|
94
104
|
- TTY detection to auto-disable rendering in non-terminal environments
|
|
95
|
-
|
|
96
|
-
[0.3.0]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.3.0
|
|
97
|
-
[0.2.0]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.2.0
|
|
98
|
-
[0.1.11]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.11
|
|
99
|
-
[0.1.10]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.10
|
|
100
|
-
[0.1.9]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.9
|
|
101
|
-
[0.1.8]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.8
|
|
102
|
-
[0.1.7]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.7
|
|
103
|
-
[0.1.6]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.6
|
|
104
|
-
[0.1.5]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.5
|
|
105
|
-
[0.1.4]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.4
|
|
106
|
-
[0.1.3]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.3
|
|
107
|
-
[0.1.2]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.2
|
|
108
|
-
[0.1.0]: https://github.com/philiprehberger/rb-progress/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -123,6 +123,8 @@ multi.finished? # => true
|
|
|
123
123
|
|--------|-------------|
|
|
124
124
|
| `.new(total:, width: 30, output: $stderr)` | Create a progress bar |
|
|
125
125
|
| `#advance(n = 1)` | Advance by `n` items |
|
|
126
|
+
| `#set(n)` | Set absolute progress position (clamped to 0..total) |
|
|
127
|
+
| `#reset` | Reset to 0, clear finished state, restart timer |
|
|
126
128
|
| `#finish` | Mark as complete |
|
|
127
129
|
| `#finished?` | Whether the bar is finished |
|
|
128
130
|
| `#percentage` | Current percentage (0.0 to 100.0) |
|
|
@@ -136,6 +138,7 @@ multi.finished? # => true
|
|
|
136
138
|
| Method | Description |
|
|
137
139
|
|--------|-------------|
|
|
138
140
|
| `.new(message:, output: $stderr)` | Create a spinner |
|
|
141
|
+
| `#message=` | Update the spinner message dynamically |
|
|
139
142
|
| `#spin` | Advance to the next frame |
|
|
140
143
|
| `#auto_spin(interval: 0.1)` | Start background thread animation |
|
|
141
144
|
| `#stop(final_message = 'done')` | Stop with a message (joins background thread) |
|
|
@@ -25,6 +25,28 @@ module Philiprehberger
|
|
|
25
25
|
self
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
# Set absolute progress position.
|
|
29
|
+
#
|
|
30
|
+
# @param n [Integer] the new current value (clamped to 0..total)
|
|
31
|
+
# @return [self]
|
|
32
|
+
def set(n)
|
|
33
|
+
return self if @finished
|
|
34
|
+
|
|
35
|
+
@current = [[n, 0].max, @total].min
|
|
36
|
+
render_to_output
|
|
37
|
+
self
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Reset the bar to 0, preserving total and width. Restarts the timer.
|
|
41
|
+
#
|
|
42
|
+
# @return [self]
|
|
43
|
+
def reset
|
|
44
|
+
@current = 0
|
|
45
|
+
@finished = false
|
|
46
|
+
@start_time = now
|
|
47
|
+
self
|
|
48
|
+
end
|
|
49
|
+
|
|
28
50
|
def finish
|
|
29
51
|
@current = @total
|
|
30
52
|
@finished = true
|