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 +4 -4
- data/lib/progress_bar.rb +4 -0
- data/lib/progress_bar/version.rb +1 -1
- data/spec/arguments_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a07562e4e740ecee296310b6d4c9600748fbc86f
|
4
|
+
data.tar.gz: f27d4a1053f6a01c29b82976973d214639075c1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/progress_bar/version.rb
CHANGED
data/spec/arguments_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: options
|