optsparser_generator 2.4 → 2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/optsparser_generator.rb +11 -5
- 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: fb4b09c837450ff62848f1c610ab5723877ed7ba
|
4
|
+
data.tar.gz: a9dc43fcb9bfa833de8976245c6e22d84c83a1c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 984af5b634471572f6ed4b1dc1e6653425bf79a630e08f8a3bf248b7eec0a471a3346a7b60654075fdf6a787193481a9d45bec856546e913088d3978a3486499
|
7
|
+
data.tar.gz: f6e433e827776db711cfa8db98680c12f0028ba86bc53567c8634320fe38ff4d3aac6098064f5e910a430d287ba3fb916e743f83d35d819719302aa595319e7e
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# OptionParser Generator
|
2
|
+
[](http://inch-ci.org/github/madblobfish/optionparser-generator)
|
3
|
+
[](https://travis-ci.org/madblobfish/optionparser-generator)
|
4
|
+
|
2
5
|
Small gem which generates an OptionParser object from an OpenStruct.
|
3
6
|
|
4
7
|
# Installation
|
data/lib/optsparser_generator.rb
CHANGED
@@ -3,15 +3,17 @@ require 'optparse'
|
|
3
3
|
|
4
4
|
# Small lib for generating an OptionParser from an OpenStruct
|
5
5
|
module OptionParserGenerator
|
6
|
-
#
|
6
|
+
# Raised when not given an OpenStruct
|
7
7
|
class WrongArgumentType < ArgumentError
|
8
8
|
end
|
9
|
-
#
|
9
|
+
# Raised when there are two boolean entries in the OpenStruct
|
10
10
|
# one named no_xyz and one xyz
|
11
|
+
#
|
11
12
|
# only raised when the option :ignore_collisions is not given
|
12
13
|
class OptionCollision < ArgumentError
|
13
14
|
end
|
14
15
|
|
16
|
+
# Does some sanity checks and prepares the OpenStruct
|
15
17
|
# @todo preprocess data here instead of doing it adhoc
|
16
18
|
# @todo raise more exceptions
|
17
19
|
# @api private
|
@@ -22,7 +24,7 @@ module OptionParserGenerator
|
|
22
24
|
ostruct.dup.freeze # not needed but makes development easier
|
23
25
|
end
|
24
26
|
|
25
|
-
#
|
27
|
+
# Does the magic
|
26
28
|
#
|
27
29
|
# @todo write documentation :(
|
28
30
|
# @todo split this up
|
@@ -82,7 +84,7 @@ module OptionParserGenerator
|
|
82
84
|
optparser
|
83
85
|
end
|
84
86
|
|
85
|
-
|
87
|
+
# patch for OptionParser redefines parse and parse!
|
86
88
|
# @api private
|
87
89
|
module OptParsePatch
|
88
90
|
# @return [OpenStruct]
|
@@ -100,10 +102,14 @@ module OptionParserGenerator
|
|
100
102
|
end
|
101
103
|
end
|
102
104
|
end
|
105
|
+
# Object alias
|
106
|
+
# @see OptionParserGenerator
|
107
|
+
OptParseGen = OptionParserGenerator
|
103
108
|
|
104
109
|
# rubocop:disable Style/MethodName
|
105
110
|
|
106
|
-
#
|
111
|
+
# Global shorthand
|
112
|
+
#
|
107
113
|
# alias to OptionParserGenerator[arg, opt]
|
108
114
|
# @return [OptionParser]
|
109
115
|
# @see OptionParserGenerator
|