optsparser_generator 2.5 → 2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/optsparser_generator.rb +16 -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: 0dc1cb64554d69901c4cd9a2e70495f188c9f486
|
4
|
+
data.tar.gz: 44b4d8c5c8d5999edf292ce4ddfdc8971b757361
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a0ea186c5015ec27fc9101bad09a1f4cde26935258ece98bedc75cd00f3996da57f23641defe5066e5c2f9b33937a115d3fe66be7cfcc03e4c65b0e9c51a693
|
7
|
+
data.tar.gz: 4d488ecf57e3e7fadf6739f836942b2a8b781dea76a37be36270523ab81ee1bca9401699d327e56feb6071953e58f330968a4c862deb67c80244732a15d6625d
|
data/lib/optsparser_generator.rb
CHANGED
@@ -101,6 +101,22 @@ module OptionParserGenerator
|
|
101
101
|
@out
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
# Shorthand when parsing is only needed once.
|
106
|
+
#
|
107
|
+
# Generates an OptionParser and calls parse on it
|
108
|
+
# @see OptionParserGenerator#[]
|
109
|
+
# @return [OpenStruct]
|
110
|
+
def self.parse(ostruct, argv = nil, **opt)
|
111
|
+
self[ostruct, opt].parse(argv)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Same as parse, removes parsed elements from argv
|
115
|
+
# @see OptionParserGenerator#parse
|
116
|
+
# @return [OpenStruct]
|
117
|
+
def self.parse!(ostruct, argv = ARGV, **opt)
|
118
|
+
self[ostruct, opt].parse!(argv)
|
119
|
+
end
|
104
120
|
end
|
105
121
|
# Object alias
|
106
122
|
# @see OptionParserGenerator
|