progressbar 1.12.0 → 1.13.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/ruby-progressbar/refinements/progress_enumerator.rb +28 -0
- data/lib/ruby-progressbar/refinements.rb +1 -1
- data/lib/ruby-progressbar/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
- data/lib/ruby-progressbar/refinements/enumerator.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 600c4958d5a0334a7b8c57e026f018d2fbbb16e5dd03b9abc1a989a36b008466
|
4
|
+
data.tar.gz: 895e70eb9b8cc7ca96d86f06e8cc8f6dd36171faa2ea61cd868541b748fdb975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd5be8205221bd7701b32a2174465bab687195e3b764d19c1ccfa1f6a748162eaed3f2259b21f06f8d4a1070c899ef6cfc262f02e6cd7409990b7ac4295fcfe3
|
7
|
+
data.tar.gz: e470d4c737a328d6aad8dbb58796408256b63c4d5efd21ef2e730141cd3ce817b6a4c0d14dec4db2165b6f73d02dcf6ee221f54432a7abd226864dd4416fcd75
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class ProgressBar
|
2
|
+
module Refinements
|
3
|
+
module Enumerator
|
4
|
+
ARITY_ERROR_MESSAGE = 'Only two arguments allowed to be passed to ' \
|
5
|
+
'with_progressbar (item, progress_bar)'.freeze
|
6
|
+
|
7
|
+
refine ::Enumerator do
|
8
|
+
def with_progressbar(options = {}, &block)
|
9
|
+
progress_bar = ProgressBar.create(options.merge(:starting_at => 0, :total => size))
|
10
|
+
|
11
|
+
each do |item|
|
12
|
+
progress_bar.increment
|
13
|
+
|
14
|
+
next unless block
|
15
|
+
|
16
|
+
yielded_args = []
|
17
|
+
yielded_args << item if block.arity > 0
|
18
|
+
yielded_args << progress_bar if block.arity > 1
|
19
|
+
|
20
|
+
fail ::ArgumentError, ARITY_ERROR_MESSAGE if block.arity > 2
|
21
|
+
|
22
|
+
yield(*yielded_args)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1 +1 @@
|
|
1
|
-
require 'ruby-progressbar/refinements/
|
1
|
+
require 'ruby-progressbar/refinements/progress_enumerator'
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: progressbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekompanee
|
@@ -125,7 +125,7 @@ files:
|
|
125
125
|
- lib/ruby-progressbar/outputs/tty.rb
|
126
126
|
- lib/ruby-progressbar/progress.rb
|
127
127
|
- lib/ruby-progressbar/refinements.rb
|
128
|
-
- lib/ruby-progressbar/refinements/
|
128
|
+
- lib/ruby-progressbar/refinements/progress_enumerator.rb
|
129
129
|
- lib/ruby-progressbar/throttle.rb
|
130
130
|
- lib/ruby-progressbar/time.rb
|
131
131
|
- lib/ruby-progressbar/timer.rb
|
@@ -136,7 +136,7 @@ licenses:
|
|
136
136
|
metadata:
|
137
137
|
bug_tracker_uri: https://github.com/jfelchner/ruby-progressbar/issues
|
138
138
|
changelog_uri: https://github.com/jfelchner/ruby-progressbar/blob/master/CHANGELOG.md
|
139
|
-
documentation_uri: https://github.com/jfelchner/ruby-progressbar/tree/releases/v1.
|
139
|
+
documentation_uri: https://github.com/jfelchner/ruby-progressbar/tree/releases/v1.13.0rc1
|
140
140
|
homepage_uri: https://github.com/jfelchner/ruby-progressbar
|
141
141
|
source_code_uri: https://github.com/jfelchner/ruby-progressbar
|
142
142
|
wiki_uri: https://github.com/jfelchner/ruby-progressbar/wiki
|
@@ -151,9 +151,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
|
-
- - "
|
154
|
+
- - ">"
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
version:
|
156
|
+
version: 1.3.1
|
157
157
|
requirements: []
|
158
158
|
rubygems_version: 3.1.6
|
159
159
|
signing_key:
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class ProgressBar
|
2
|
-
module Refinements
|
3
|
-
module Enumerator
|
4
|
-
refine ::Enumerator do
|
5
|
-
def with_progressbar(options = {}, &block)
|
6
|
-
chain = ::Enumerator.new do |yielder|
|
7
|
-
progress_bar = ProgressBar.create(options.merge(:starting_at => 0, :total => size))
|
8
|
-
|
9
|
-
each do |*args|
|
10
|
-
yielder.yield(*args).tap do
|
11
|
-
progress_bar.increment
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
return chain unless block
|
17
|
-
|
18
|
-
chain.each(&block)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|