optparse2 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7af25aed35f6e83c5d21f2243c8cc714f182f32a5f012ad93dd04486e8ba5865
4
- data.tar.gz: c7804d256d8ead6a97f9edbcd6049ccb9d9226a297341a8fe6888b39133023c3
3
+ metadata.gz: f72b9507463f134c1c50c41330ab92e73c087764f0e378b84bff1819f52997e6
4
+ data.tar.gz: 0d46f1626d79f5a056a754467338dbb640e425d46b81c36747aab525ec69b340
5
5
  SHA512:
6
- metadata.gz: 00fe7339a1b17afec474b3e1719ea7b774c2ffb5ae55c73310d81c9907a804958909160d7c04df4efbd626ee6a8eb3f85d969b28508f57ed74c0a8090ea2384b
7
- data.tar.gz: c01111aa1350878a7a060a3bec5a283465349a0c4bbe498a48d22b59d1c3f15736e9d180b9eed127c02a5c6a67e0e2ff973e3aad31e54e3109203ab7a5a9d155
6
+ metadata.gz: 6e647563d1b3ffc9d1f8501ae527a1de6c4069bc69cd7c81f0a456a2938f203ed22606383115a0dcf2d3ef2c71f680fa72810379cb14655608895ed10c915d04
7
+ data.tar.gz: 37805f0e018d3b842807cca56e5dcaf2906c5ad0c873171279816a658bc8b9dc6eb20faad51b4dbf4da4f557467895a4845e8104d5eb3b77f71afce748d1fea3
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class OptParse2
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.1"
5
5
  end
data/lib/optparse2.rb CHANGED
@@ -173,10 +173,13 @@ class OptParse2
173
173
  ensure_all_required_arguments_were_supplied!(context)
174
174
 
175
175
  # For each non-option argument, call the `nonopt` block
176
- not_matched_options.each(&nonopt)
177
-
178
- # Replace the original argv with the resulting options
179
- argv.replace not_matched_options
176
+ if nonopt
177
+ not_matched_options.each(&nonopt)
178
+ argv.clear
179
+ else
180
+ # Replace the original argv with the resulting options
181
+ argv.replace not_matched_options
182
+ end
180
183
  end
181
184
  rescue OptionParser::ParseError => err
182
185
  abort ? abort(err) : raise
@@ -270,17 +273,6 @@ class OptParse2
270
273
  end
271
274
  end
272
275
 
273
- __END__
274
-
275
- OptParse2.new do |op|
276
- op.switch('-f', '--foo=BAR', 'does it')
277
- .default { p $x += 1 }
278
- .build!
279
- op.parse! into: opts={}
280
- p opts
281
- p $x
282
- end
283
-
284
276
  __END__
285
277
  OptParse2.new do |op|
286
278
  op.on '-f', '--foo=BAR', 'does it', default: 10, default_description: nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optparse2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamW