fortschritt 1.0.0 → 1.0.2

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: 410850425ce6a0416aba93fa42c7f889b084a10f945c69196b2ba1fdca08c6da
4
- data.tar.gz: b83172478ef655c56e7931e4228d9ee1c24a0c2518ebbf0fc06c1b4bb464bdd8
3
+ metadata.gz: fd0c35e7e695d81aaccb2198055650ffa4f5f101e27314010ca494ba1bfb035a
4
+ data.tar.gz: 1c3899f51b10f3a574f0c406cc7746e5d67c21bab84558ab1450db79fe2dd419
5
5
  SHA512:
6
- metadata.gz: f4f1f157407ac01655408da4ced69b54e20989270bb24e5222cbdf73ca87e3705497825ccc20f96c231aae85c1d185aff4f873fb927139bc51c5174580663f3e
7
- data.tar.gz: 8c4790fb62d00205e92afde33dc39b6f7ebab7700688f3c0e9baf686a73026d7f55bc8d5abf766c2f01cb48eb99ba023e30bd842187c60d150a60668b73c661d
6
+ metadata.gz: a22105138d4796308f9463c0362edc22668e0e03c9ad719040f0b9f1df527ad4df757d9c16a05ab59d83fdb335ab8e3fc303e2d729f4ec71b11420e3c6069be7
7
+ data.tar.gz: c03e57097d0eb989d8110bd57ab5df74a7aaff6f0cf517a56f652b58d2284eaa1217a4422ff6c79b57369cb57d94d22651135d8adc01947a1538b2d80b2da703
data/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  * no tty stuff
6
6
  * no terminal size calculation
7
7
  * no dependencies
8
+
9
+ ![fortschritt](https://user-images.githubusercontent.com/10758879/146650253-878fa450-3a2e-44ad-b28a-ba2dce9050bc.gif)
8
10
 
9
11
  ## Installation
10
12
 
@@ -14,15 +14,13 @@ end
14
14
 
15
15
  if defined?(Rails)
16
16
  module Fortschritt::ActiveRecordExtension
17
-
18
- extend ActiveSupport::Concern
19
-
20
17
  def with_fortschritt(**opts)
21
18
  Fortschritt.init(size, **opts)
22
19
  self
23
20
  end
24
21
  end
25
22
 
26
- ActiveRecord::Relation.send(:include, Fortschritt::ActiveRecordExtension)
23
+ ActiveRecord::Relation.include Fortschritt::ActiveRecordExtension
24
+ ActiveRecord::Base.singleton_class.delegate :with_fortschritt, to: :all
27
25
  end
28
26
 
@@ -9,6 +9,7 @@ module Fortschritt
9
9
  @average_seconds = 0
10
10
  @started_at = Time.now
11
11
  @silent = silent || !!(Rails.env.test? if defined?(Rails))
12
+ @printed_at = Time.now
12
13
  end
13
14
 
14
15
  def increment
@@ -17,7 +18,7 @@ module Fortschritt
17
18
  @average_seconds = calculate_average_seconds(elapsed_seconds)
18
19
  @updated_at = @_now
19
20
  @done += 1
20
- print! unless @silent
21
+ print! unless @silent || debounce?
21
22
  end
22
23
 
23
24
  def completed?
@@ -44,5 +45,12 @@ module Fortschritt
44
45
  def print!
45
46
  Fortschritt.printer.print(self)
46
47
  end
48
+
49
+ def debounce?
50
+ return true if @updated_at - @printed_at < 0.01 && !completed?
51
+
52
+ @printed_at = @updated_at
53
+ false
54
+ end
47
55
  end
48
56
  end
@@ -1,3 +1,3 @@
1
1
  module Fortschritt
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fortschritt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Opper
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-01 00:00:00.000000000 Z
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,7 +79,7 @@ homepage: https://github.com/xijo/fortschritt
79
79
  licenses:
80
80
  - WTFPL
81
81
  metadata: {}
82
- post_install_message:
82
+ post_install_message:
83
83
  rdoc_options: []
84
84
  require_paths:
85
85
  - lib
@@ -94,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  requirements: []
97
- rubygems_version: 3.1.4
98
- signing_key:
97
+ rubygems_version: 3.4.19
98
+ signing_key:
99
99
  specification_version: 4
100
100
  summary: non-fancy progress
101
101
  test_files: []