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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e092368a712551dfe8ffcc0b0cb01ef2cff5f20
4
- data.tar.gz: 87aec6c08190dbf3a297ef3fe478aedbd5358ada
3
+ metadata.gz: 05a57c0b8543b3a3f9efa9e4d96f185a606cb6b5
4
+ data.tar.gz: dea390d881e3790ca2fe375cecd5bbd5e2244093
5
5
  SHA512:
6
- metadata.gz: 9f0c34b531a9d8fd59e602a738fa27741d0db8934c8f881575180fd9b8ce4ea0fc1c4629205f136dab9987a7c30f99edb0ab96948e7b5ca2246bc7083b67b650
7
- data.tar.gz: cd634371172bfd2d512392c2eb0f46e3bdab3129ffe903b0bc8fa3393efd544d86b8768de407616abe89aa045dbd2f271aff42d6c7aef83c86eb5f8a2d37d478
6
+ metadata.gz: e72725f0651044da4ba30c42f6e9fb87d785bcc8e1997d25ac25c2a6973c9aadf9b94a5e2a0a7b158469d280269ef39c3ff4efc80642f4f38b48df5e59a93eb4
7
+ data.tar.gz: 13f9c971e2ce10b2b36be0dc7cd891e25796b733b0fba3a0e5aeacb17949be4d8536e900bbd9901a8d85043500570e7d8843adc9b4b600c8e41a19a1e7709e9f
@@ -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.2"
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
@@ -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
@@ -71,8 +71,7 @@ module Dreck
71
71
  count = count_expected
72
72
 
73
73
  return if count.nil?
74
- raise AbsorptionError, "too few arguments" if count > @args.size && strict?
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.2
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-22 00:00:00.000000000 Z
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