dreck 0.0.1 → 0.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: eaaec798888ca9a462d16bf380853aafa47eba29
4
- data.tar.gz: e3657ca419dc6a331a292af9778402d1e6d37e6e
3
+ metadata.gz: 8e092368a712551dfe8ffcc0b0cb01ef2cff5f20
4
+ data.tar.gz: 87aec6c08190dbf3a297ef3fe478aedbd5358ada
5
5
  SHA512:
6
- metadata.gz: f77bdc510acefb7c00223ed0e49d160c9f19749e92a9ea100539cdcfd0cb9798b1f11314828a906a67771f4cc3e7460939c2499b046680d93bc839a3df35ed85
7
- data.tar.gz: 0ced355c2e535154d7702ca4e47eb1dc3469aaa8789b05ec367d84e16b462827a784aab812efeefcb316c0f8923cd7bdad936d8a4a2387589f8337951fdc8285
6
+ metadata.gz: 9f0c34b531a9d8fd59e602a738fa27741d0db8934c8f881575180fd9b8ce4ea0fc1c4629205f136dab9987a7c30f99edb0ab96948e7b5ca2246bc7083b67b650
7
+ data.tar.gz: cd634371172bfd2d512392c2eb0f46e3bdab3129ffe903b0bc8fa3393efd544d86b8768de407616abe89aa045dbd2f271aff42d6c7aef83c86eb5f8a2d37d478
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  dreck
2
2
  =====
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/dreck.svg)](https://badge.fury.io/rb/dreck)
5
+
4
6
  A stupid parser for trailing arguments.
5
7
 
6
8
  ### Motivation
@@ -55,7 +57,12 @@ result = Dreck.parse opts.args do
55
57
  list :int, :nums
56
58
  end
57
59
 
58
- result[:id] # => "01aa84ab-5b2c-4861-adc9-fcc6990a5ca5"
60
+ result[:uuid] # => "01aa84ab-5b2c-4861-adc9-fcc6990a5ca5"
59
61
  result[:inputs] # => ["/tmp/foo", "/tmp/bar"]
60
62
  result[:nums] # => [1, 2, 3, 4, 5]
61
63
  ```
64
+
65
+ ### TODO
66
+
67
+ * Guarding against multiple unbound lists/unbound list before scalar types
68
+ * Custom types?
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.1"
8
+ VERSION = "0.0.2"
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/parser.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "parser"
4
-
5
3
  module Dreck
6
4
  # Type and other constraint testing methods for {Dreck}.
7
5
  class Parser
@@ -58,12 +56,12 @@ module Dreck
58
56
  # @return [String] the coerced string
59
57
  # @note This does nothing.
60
58
  def parse_string(str)
61
- str
59
+ str.to_s
62
60
  end
63
61
 
64
62
  # @param type [Symbol] the type of each member of the list
65
63
  # @param list [Array<String>] the value of each member
66
- # @return [Object] the coerced results
64
+ # @return [Array<Object>] the coerced results
67
65
  def parse_list(type, list)
68
66
  list.map { |arg| send "parse_#{type}", arg }
69
67
  end
data/lib/dreck/result.rb CHANGED
@@ -71,8 +71,8 @@ module Dreck
71
71
  count = count_expected
72
72
 
73
73
  return if count.nil?
74
- raise AbsoptionError, "too few arguments" if count > @args.size && strict?
75
- raise AbsoptionError, "too many arguments" if count < @args.size && strict?
74
+ raise AbsorptionError, "too few arguments" if count > @args.size && strict?
75
+ raise AbsorptionError, "too many arguments" if count < @args.size && strict?
76
76
  end
77
77
 
78
78
  # Count the number of arguments expected to be supplied.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dreck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff