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 +4 -4
- data/README.md +2 -0
- data/lib/fortschritt/enumerable.rb +2 -4
- data/lib/fortschritt/meter.rb +9 -1
- data/lib/fortschritt/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd0c35e7e695d81aaccb2198055650ffa4f5f101e27314010ca494ba1bfb035a
|
4
|
+
data.tar.gz: 1c3899f51b10f3a574f0c406cc7746e5d67c21bab84558ab1450db79fe2dd419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a22105138d4796308f9463c0362edc22668e0e03c9ad719040f0b9f1df527ad4df757d9c16a05ab59d83fdb335ab8e3fc303e2d729f4ec71b11420e3c6069be7
|
7
|
+
data.tar.gz: c03e57097d0eb989d8110bd57ab5df74a7aaff6f0cf517a56f652b58d2284eaa1217a4422ff6c79b57369cb57d94d22651135d8adc01947a1538b2d80b2da703
|
data/README.md
CHANGED
@@ -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.
|
23
|
+
ActiveRecord::Relation.include Fortschritt::ActiveRecordExtension
|
24
|
+
ActiveRecord::Base.singleton_class.delegate :with_fortschritt, to: :all
|
27
25
|
end
|
28
26
|
|
data/lib/fortschritt/meter.rb
CHANGED
@@ -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
|
data/lib/fortschritt/version.rb
CHANGED
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.
|
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:
|
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.
|
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: []
|