dreck 0.1.1 → 0.2.0
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 +5 -0
- data/lib/dreck/result.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bb0f4c554c04b604345d8188c40a8ad320c1708
|
4
|
+
data.tar.gz: 790ff1a92be0e412c7435e9fc7371c35a5672450
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0296b43f00a880bd0936483cc9b5eaa6fda6bd04abd4cbe4c5d717050dd3c51a4f884cf00194fdbe153ff130786426c0457229201e59792434a2ebb251b43003'
|
7
|
+
data.tar.gz: 6b3e56d3e99a701e0e1664862f5df4e3ae0cefcb3472540a4c84ccc9e24a4c096f2c8a2ef47fca3c01ed44a7ce2e4ae5691c737c857b609b736460f3c4f6140f
|
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.
|
8
|
+
VERSION = "0.2.0"
|
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
@@ -5,6 +5,11 @@ module Dreck
|
|
5
5
|
class DreckError < RuntimeError
|
6
6
|
end
|
7
7
|
|
8
|
+
# Raised during list specification if a non-positive number of arguments
|
9
|
+
# are requested.
|
10
|
+
class BadCountError < DreckError
|
11
|
+
end
|
12
|
+
|
8
13
|
# Raised during argument absorption if arguments are either left over
|
9
14
|
# or are insufficient to populate the expected results.
|
10
15
|
class AbsorptionError < DreckError
|
data/lib/dreck/result.rb
CHANGED
@@ -43,6 +43,10 @@ module Dreck
|
|
43
43
|
# @param sym [Symbol] the name of the argument in {results}
|
44
44
|
# @param count [Integer] the number of arguments in the list
|
45
45
|
def list(type, sym, count: nil)
|
46
|
+
if count
|
47
|
+
raise BadCountError unless count.positive?
|
48
|
+
end
|
49
|
+
|
46
50
|
@expected << [:list, type, sym, count]
|
47
51
|
end
|
48
52
|
|