terminal-progress 0.1.0.2 → 0.2.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/lib/terminal_progress.rb +15 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7603c103fd15edf49d15f54066589e024b1c2c4b05c49bcf09776962dd40828e
|
4
|
+
data.tar.gz: ee490a006600d7218ef211721f5f4003a1bd1f9bf73f43f2349b70ae4d6b1448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69c98f81c79cd30f9498bd08cd949ce49423b4a67ad91c49971b4f363f8942efdee4043f7152fa680e37d71bffe3996f722c925df9e5c73125a2e6a1ffff3744
|
7
|
+
data.tar.gz: dfcefd351b40a8d40a7aeeacffc57934e58b0e36dff58b68ab53afb15da467d146b924c110b0a095fef558f45c11ee59c597cb4ec063e1e5cf1b2501111bea59
|
data/lib/terminal_progress.rb
CHANGED
@@ -52,6 +52,21 @@ class TerminalProgress
|
|
52
52
|
printf " #{@max}/#{@max}: [#{'='.light_yellow * width}#{suffix}\r\n"
|
53
53
|
end
|
54
54
|
|
55
|
+
# Call this to dynamically update the maximum value of the task bar.
|
56
|
+
def update_max(new_max)
|
57
|
+
raise ArgumentError, 'new_max must be positive' unless new_max.positive?
|
58
|
+
|
59
|
+
@max = new_max
|
60
|
+
@i = [@i, @max].min
|
61
|
+
end
|
62
|
+
|
63
|
+
# Call this to dynamically add a value to the maximum value of the task bar
|
64
|
+
def add_to_max(num)
|
65
|
+
raise ArgumentError, 'num must be positive' unless num.positive?
|
66
|
+
|
67
|
+
@max += num
|
68
|
+
end
|
69
|
+
|
55
70
|
# Terminate the progress loop.
|
56
71
|
def kill
|
57
72
|
Thread.kill @loop
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal-progress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Whittaker
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -66,7 +66,7 @@ licenses:
|
|
66
66
|
- MIT
|
67
67
|
metadata:
|
68
68
|
rubygems_mfa_required: 'true'
|
69
|
-
post_install_message:
|
69
|
+
post_install_message:
|
70
70
|
rdoc_options: []
|
71
71
|
require_paths:
|
72
72
|
- lib
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubygems_version: 3.3.26
|
85
|
-
signing_key:
|
85
|
+
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: terminal-progress - Simplify progress tracking in your Ruby applications
|
88
88
|
with this simple progress bar manager.
|