progress_bar 1.0.1 → 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
  SHA1:
3
- metadata.gz: 539f2c8c964f499f6c33cc125567cb718d667092
4
- data.tar.gz: 498840c84fce2af2c9dcb08cfb1ba00bc81e94fe
3
+ metadata.gz: a07562e4e740ecee296310b6d4c9600748fbc86f
4
+ data.tar.gz: f27d4a1053f6a01c29b82976973d214639075c1f
5
5
  SHA512:
6
- metadata.gz: 0154bcf069ac2013326e46b6d1dff3864727e856d4177d057daa292a34b18859ade048776084485a0d913b3862f3eca5e2536d9aaf7139aa0008bcd832f042be
7
- data.tar.gz: 259ad893bd1923d0553fbd70a71480139ddde828d7b75c6cbf73329386c4e62dccca2e66125e31ace43cfcb67fb6b9195a77446e609530b4a40aa61c85a9f616
6
+ metadata.gz: ce5db1fecd0c834b67330b366bede9c571fce4e3dc8d046df5e12e5bc811ba29146d16f395d3459177fcef59d6a0ecb47671a04fec5a1ca68a4723fe8c069f39
7
+ data.tar.gz: 6cfa098ce5efcffbb81318e8e2fce719735774ab91010ba36a76f5ec248250ace1977f4a2a79d04c783aae30ca1fc24dcc923b2aa8e5f2f191be9332edce1c69
data/lib/progress_bar.rb CHANGED
@@ -3,6 +3,8 @@ require 'options'
3
3
  require 'highline'
4
4
 
5
5
  class ProgressBar
6
+ Error = Class.new(StandardError)
7
+ ArgumentError = Class.new(Error)
6
8
 
7
9
  attr_accessor :count, :max, :meters
8
10
 
@@ -13,6 +15,8 @@ class ProgressBar
13
15
  @meters = [:bar, :counter, :percentage, :elapsed, :eta, :rate]
14
16
 
15
17
  @max = args.shift if args.first.is_a? Numeric
18
+ raise ArgumentError, "Max must be a positive integer" unless @max > 0
19
+
16
20
  @meters = args unless args.empty?
17
21
 
18
22
  @last_write = ::Time.at(0)
@@ -1,3 +1,3 @@
1
1
  class ProgressBar
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -30,5 +30,11 @@ describe 'ProgressBar arguments' do
30
30
  bar.meters.should == [:bar, :eta]
31
31
  end
32
32
 
33
+ it "should raise an error when initial max is nonsense" do
34
+ lambda {
35
+ bar = ProgressBar.new(0)
36
+ }.should raise_error(ProgressBar::ArgumentError)
37
+ end
38
+
33
39
  end
34
40
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progress_bar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Sadauskas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: options