popro 0.1.3 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c44ac97a28d694e15a696c5f17bd6c3b4ae7198f04390f32119f53e02aab48b1
4
- data.tar.gz: 6aa1744397c4b03126ef3f945acaa6c57ad55bc17c152483f514f190f6616b48
3
+ metadata.gz: 953431a63b91d3bb07e70cf638262c74dbbca5ced53020b5f6ba4b0b87b4a19f
4
+ data.tar.gz: 9658ac180fa9259438c95ab264c19d0588da7c959187ddbf169ea130f639296d
5
5
  SHA512:
6
- metadata.gz: '09c839770f6b8c02f1f2456a0f41cd61cadb70da8dbd2cc8a7f4aef4eab578e6a918115770137d3a29d05bf6829ef45219d5ea28e37329da70d49dec8c581aef'
7
- data.tar.gz: 74689916c7ad0d6484e4371506578275a93c3d9f0a2f6e49b6761141dcf2b5fd8acedbe5d97ec21395893d4aa44310b639e4e97022b9de3dee09a5eea56938b2
6
+ metadata.gz: f04c243ad12db54726a87e17527d031adcea1f8229d8e815768c5e9416132c9c14b65e4ba324e0733bd15fb7a8773942499caa9aafa8566f97b7d39848f43091
7
+ data.tar.gz: a6c71eec92cc09a69742cb4c9dba2fec469595804589a12d468d5093ae8b3a7d316aad639b0091ead3f0f5fa7bea694cf6dcb996b3ded7922e79d9762ef75916
data/CHANGELOG CHANGED
@@ -1 +1,2 @@
1
+ 0.2.0 various fixes and added unit tests
1
2
  0.0.1 initial version
@@ -7,7 +7,7 @@ module Popro
7
7
 
8
8
  require_relative 'popro/progress'
9
9
 
10
- def self.new(total, **options, &block)
10
+ def self.new(total=0, **options, &block)
11
11
  raise ConfigError, 'using :total is not supported in new' if options.key?(:total) && (options[:total] != total)
12
12
 
13
13
  options[:total] = total
@@ -15,7 +15,6 @@ module Popro
15
15
  end
16
16
 
17
17
  def self.each(obj, total = nil, **options, &block)
18
- options[:step] = 0 unless options.key? :step
19
18
  new(0, **options).each(obj, total, &block).done
20
19
  end
21
20
 
@@ -9,20 +9,19 @@ module Popro
9
9
  DEFAULT_OPTIONS ||= {
10
10
  total: 0,
11
11
  current: 0,
12
+ indicator: Indicator.default
12
13
  }.freeze
13
14
 
14
15
  attr_reader :context
15
16
 
16
17
  def initialize(**options)
17
- options.merge!(DEFAULT_OPTIONS)
18
-
19
18
  @started = false
20
19
 
21
- @info = Info.new(total: options.delete(:total), current: options.delete(:current))
22
-
23
- options[:step] ||= (block_given? ? 0 : 1)
20
+ options = DEFAULT_OPTIONS
21
+ .merge(step: block_given? ? 0 : 1)
22
+ .merge(options)
24
23
 
25
- options[:indicator] = Indicator.default unless options.key? :indicator
24
+ @info = Info.new(total: options.delete(:total), current: options.delete(:current))
26
25
 
27
26
  options.merge!(progress: self, info: @info)
28
27
  @context = Context.new(**options)
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MikeSmithEU
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-01 00:00:00.000000000 Z
11
+ date: 2020-09-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Poor-Man's Progress Indicator
14
- email:
14
+ email:
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
@@ -31,7 +31,7 @@ homepage: https://rubygems.org/gems/popro
31
31
  licenses:
32
32
  - MIT
33
33
  metadata: {}
34
- post_install_message:
34
+ post_install_message:
35
35
  rdoc_options: []
36
36
  require_paths:
37
37
  - lib
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  version: '0'
48
48
  requirements: []
49
49
  rubygems_version: 3.1.2
50
- signing_key:
50
+ signing_key:
51
51
  specification_version: 4
52
52
  summary: Po'Pro
53
53
  test_files: []