optsparser_generator 2.5 → 2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/optsparser_generator.rb +16 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb4b09c837450ff62848f1c610ab5723877ed7ba
4
- data.tar.gz: a9dc43fcb9bfa833de8976245c6e22d84c83a1c9
3
+ metadata.gz: 0dc1cb64554d69901c4cd9a2e70495f188c9f486
4
+ data.tar.gz: 44b4d8c5c8d5999edf292ce4ddfdc8971b757361
5
5
  SHA512:
6
- metadata.gz: 984af5b634471572f6ed4b1dc1e6653425bf79a630e08f8a3bf248b7eec0a471a3346a7b60654075fdf6a787193481a9d45bec856546e913088d3978a3486499
7
- data.tar.gz: f6e433e827776db711cfa8db98680c12f0028ba86bc53567c8634320fe38ff4d3aac6098064f5e910a430d287ba3fb916e743f83d35d819719302aa595319e7e
6
+ metadata.gz: 9a0ea186c5015ec27fc9101bad09a1f4cde26935258ece98bedc75cd00f3996da57f23641defe5066e5c2f9b33937a115d3fe66be7cfcc03e4c65b0e9c51a693
7
+ data.tar.gz: 4d488ecf57e3e7fadf6739f836942b2a8b781dea76a37be36270523ab81ee1bca9401699d327e56feb6071953e58f330968a4c862deb67c80244732a15d6625d
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optsparser_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.5'
4
+ version: '2.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marvin Zerulla