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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/terminal_progress.rb +15 -0
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc02cff7acb1fae23419d38b973cc5f28f4823693fd50c36fea2ef0f4482defe
4
- data.tar.gz: dd66c0cd432e7c1c1079116c21e58b4b69eeb1a3eb442a8332f704a04339c22e
3
+ metadata.gz: 7603c103fd15edf49d15f54066589e024b1c2c4b05c49bcf09776962dd40828e
4
+ data.tar.gz: ee490a006600d7218ef211721f5f4003a1bd1f9bf73f43f2349b70ae4d6b1448
5
5
  SHA512:
6
- metadata.gz: 3a87870427f513a6c3d2f7a7c63c912933a877782b1d5378f3e9e3ad88bef2ac5fe51b2239c473efdbd7974cffc823eb828a7c69acf879a15a8b8fee9ed8315e
7
- data.tar.gz: a271fe48e0930ad7595203d33db2724bf390078fd96740c48e96d800f6c8dd2e58e104f51037344db1c72cfe36e2481ccf5b14291d03733eb389e7a4796406fb
6
+ metadata.gz: 69c98f81c79cd30f9498bd08cd949ce49423b4a67ad91c49971b4f363f8942efdee4043f7152fa680e37d71bffe3996f722c925df9e5c73125a2e6a1ffff3744
7
+ data.tar.gz: dfcefd351b40a8d40a7aeeacffc57934e58b0e36dff58b68ab53afb15da467d146b924c110b0a095fef558f45c11ee59c597cb4ec063e1e5cf1b2501111bea59
@@ -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.1.0.2
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: 2023-10-05 00:00:00.000000000 Z
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.