dreck 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dreck.rb +1 -1
- data/lib/dreck/exceptions.rb +4 -0
- data/lib/dreck/result.rb +1 -2
- 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: 05a57c0b8543b3a3f9efa9e4d96f185a606cb6b5
|
4
|
+
data.tar.gz: dea390d881e3790ca2fe375cecd5bbd5e2244093
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e72725f0651044da4ba30c42f6e9fb87d785bcc8e1997d25ac25c2a6973c9aadf9b94a5e2a0a7b158469d280269ef39c3ff4efc80642f4f38b48df5e59a93eb4
|
7
|
+
data.tar.gz: 13f9c971e2ce10b2b36be0dc7cd891e25796b733b0fba3a0e5aeacb17949be4d8536e900bbd9901a8d85043500570e7d8843adc9b4b600c8e41a19a1e7709e9f
|
data/lib/dreck.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative "dreck/result"
|
|
5
5
|
# The primary namespace for {Dreck}.
|
6
6
|
module Dreck
|
7
7
|
# {Dreck}'s current version.
|
8
|
-
VERSION = "0.0.
|
8
|
+
VERSION = "0.0.3"
|
9
9
|
|
10
10
|
# Parse the given arguments and produce a result.
|
11
11
|
# @param args [Array<String>] the arguments to parse
|
data/lib/dreck/exceptions.rb
CHANGED
@@ -8,6 +8,10 @@ module Dreck
|
|
8
8
|
# Raised during argument absorption if arguments are either left over
|
9
9
|
# or are insufficient to populate the expected results.
|
10
10
|
class AbsorptionError < DreckError
|
11
|
+
def initialize(actual, expected)
|
12
|
+
nmany = actual > expected ? "too many" : "too few"
|
13
|
+
super "#{nmany} arguments given (#{actual}, expected #{expected})"
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
# Raised during parsing if a given type cannot be produced from the corresponding
|
data/lib/dreck/result.rb
CHANGED
@@ -71,8 +71,7 @@ module Dreck
|
|
71
71
|
count = count_expected
|
72
72
|
|
73
73
|
return if count.nil?
|
74
|
-
raise AbsorptionError,
|
75
|
-
raise AbsorptionError, "too many arguments" if count < @args.size && strict?
|
74
|
+
raise AbsorptionError.new(count, @args.size) if count != @args.size && strict?
|
76
75
|
end
|
77
76
|
|
78
77
|
# Count the number of arguments expected to be supplied.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dreck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Typechecks and coerces non-option arguments.
|
14
14
|
email: william@tuffbizz.com
|