fortschritt 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/fortschritt.rb +2 -2
- data/lib/fortschritt/enumerable.rb +4 -4
- data/lib/fortschritt/meter.rb +4 -3
- data/lib/fortschritt/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a92442302e3a29a76a4b7ad91023207829331f0
|
4
|
+
data.tar.gz: ef3b5987065f98e24da36364644dc8d023a929f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d49b3d43256832e3484f636ad5395b6c3da842c054af1d5da03f64190cca85fe0edf5f2c09dd2c24bbaeee3f1fc11ad39d121a965e38ae5a88c6684438121dd
|
7
|
+
data.tar.gz: 2545182e4607938fd1e252faca16b23cc8d5222669f615231c362d6a62a67ffb19125a7f94d627d7d8e6cf84f53ab1e3d192cb99c7fdd8d846e84fa4c4eb8ec0
|
data/README.md
CHANGED
@@ -32,6 +32,18 @@ end
|
|
32
32
|
# will print something like this: 1616/145096 → 00:13:21 → ETA 2016-02-04 18:11:50
|
33
33
|
```
|
34
34
|
|
35
|
+
### Silent
|
36
|
+
|
37
|
+
If no output is required or wanted invoke `with_fortschritt` with the `silent: true` option
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
User.all.with_fortschritt(silent: true).find_each do |user|
|
41
|
+
user.fortschritt.valid?
|
42
|
+
end
|
43
|
+
|
44
|
+
# won't output any progress
|
45
|
+
```
|
46
|
+
|
35
47
|
## Contributing
|
36
48
|
|
37
49
|
Bug reports and pull requests are welcome on GitHub at https://github.com/xijo/fortschritt.
|
data/lib/fortschritt.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Enumerable
|
2
|
-
def with_fortschritt
|
3
|
-
Fortschritt.init(size)
|
2
|
+
def with_fortschritt(opts = {})
|
3
|
+
Fortschritt.init(size, opts)
|
4
4
|
self
|
5
5
|
end
|
6
6
|
end
|
@@ -17,8 +17,8 @@ if defined?(Rails)
|
|
17
17
|
|
18
18
|
extend ActiveSupport::Concern
|
19
19
|
|
20
|
-
def with_fortschritt
|
21
|
-
Fortschritt.init(count)
|
20
|
+
def with_fortschritt(opts = {})
|
21
|
+
Fortschritt.init(count, opts)
|
22
22
|
self
|
23
23
|
end
|
24
24
|
end
|
data/lib/fortschritt/meter.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
module Fortschritt
|
2
2
|
class Meter
|
3
|
-
attr_accessor :total, :done, :updated_at, :average_seconds
|
3
|
+
attr_accessor :total, :done, :updated_at, :average_seconds, :silent
|
4
4
|
|
5
|
-
def initialize(total)
|
5
|
+
def initialize(total, silent: false)
|
6
6
|
@total = total
|
7
7
|
@done = 0
|
8
8
|
@updated_at = Time.now
|
9
9
|
@average_seconds = 0
|
10
10
|
@started_at = Time.now
|
11
|
+
@silent = silent
|
11
12
|
end
|
12
13
|
|
13
14
|
def increment
|
@@ -16,7 +17,7 @@ module Fortschritt
|
|
16
17
|
@average_seconds = calculate_average_seconds(elapsed_seconds)
|
17
18
|
@updated_at = @_now
|
18
19
|
@done += 1
|
19
|
-
print!
|
20
|
+
print! unless @silent
|
20
21
|
end
|
21
22
|
|
22
23
|
def completed?
|
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: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Opper
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,9 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.5.
|
95
|
+
rubygems_version: 2.5.2
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: non-fancy progress
|
99
99
|
test_files: []
|
100
|
-
has_rdoc:
|