optparse 0.3.1 → 0.5.0

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.
data/lib/optparse.rb CHANGED
@@ -8,7 +8,6 @@
8
8
  # See OptionParser for documentation.
9
9
  #
10
10
 
11
-
12
11
  #--
13
12
  # == Developer Documentation (not for RDoc output)
14
13
  #
@@ -48,7 +47,7 @@
48
47
  #
49
48
  # == OptionParser
50
49
  #
51
- # === New to \OptionParser?
50
+ # === New to +OptionParser+?
52
51
  #
53
52
  # See the {Tutorial}[optparse/tutorial.rdoc].
54
53
  #
@@ -152,14 +151,14 @@
152
151
  # OptionParser supports the ability to coerce command line arguments
153
152
  # into objects for us.
154
153
  #
155
- # OptionParser comes with a few ready-to-use kinds of type
154
+ # OptionParser comes with a few ready-to-use kinds of type
156
155
  # coercion. They are:
157
156
  #
158
- # - Date -- Anything accepted by +Date.parse+
159
- # - DateTime -- Anything accepted by +DateTime.parse+
160
- # - Time -- Anything accepted by +Time.httpdate+ or +Time.parse+
161
- # - URI -- Anything accepted by +URI.parse+
162
- # - Shellwords -- Anything accepted by +Shellwords.shellwords+
157
+ # - Date -- Anything accepted by +Date.parse+ (need to require +optparse/date+)
158
+ # - DateTime -- Anything accepted by +DateTime.parse+ (need to require +optparse/date+)
159
+ # - Time -- Anything accepted by +Time.httpdate+ or +Time.parse+ (need to require +optparse/time+)
160
+ # - URI -- Anything accepted by +URI.parse+ (need to require +optparse/uri+)
161
+ # - Shellwords -- Anything accepted by +Shellwords.shellwords+ (need to require +optparse/shellwords+)
163
162
  # - String -- Any non-empty string
164
163
  # - Integer -- Any integer. Will convert octal. (e.g. 124, -3, 040)
165
164
  # - Float -- Any float. (e.g. 10, 3.14, -100E+13)
@@ -425,7 +424,8 @@
425
424
  # If you have any questions, file a ticket at http://bugs.ruby-lang.org.
426
425
  #
427
426
  class OptionParser
428
- OptionParser::Version = "0.3.1"
427
+ # The version string
428
+ OptionParser::Version = "0.5.0"
429
429
 
430
430
  # :stopdoc:
431
431
  NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
@@ -438,6 +438,8 @@ class OptionParser
438
438
  # and resolved against a list of acceptable values.
439
439
  #
440
440
  module Completion
441
+ # :nodoc:
442
+
441
443
  def self.regexp(key, icase)
442
444
  Regexp.new('\A' + Regexp.quote(key).gsub(/\w+\b/, '\&\w*'), icase)
443
445
  end
@@ -459,7 +461,7 @@ class OptionParser
459
461
  candidates
460
462
  end
461
463
 
462
- def candidate(key, icase = false, pat = nil)
464
+ def candidate(key, icase = false, pat = nil, &_)
463
465
  Completion.candidate(key, icase, pat, &method(:each))
464
466
  end
465
467
 
@@ -510,6 +512,8 @@ class OptionParser
510
512
  # RequiredArgument, etc.
511
513
  #
512
514
  class Switch
515
+ # :nodoc:
516
+
513
517
  attr_reader :pattern, :conv, :short, :long, :arg, :desc, :block
514
518
 
515
519
  #
@@ -697,6 +701,11 @@ class OptionParser
697
701
  q.object_group(self) {pretty_print_contents(q)}
698
702
  end
699
703
 
704
+ def omitted_argument(val) # :nodoc:
705
+ val.pop if val.size == 3 and val.last.nil?
706
+ val
707
+ end
708
+
700
709
  #
701
710
  # Switch that takes no arguments.
702
711
  #
@@ -710,10 +719,10 @@ class OptionParser
710
719
  conv_arg(arg)
711
720
  end
712
721
 
713
- def self.incompatible_argument_styles(*)
722
+ def self.incompatible_argument_styles(*) # :nodoc:
714
723
  end
715
724
 
716
- def self.pattern
725
+ def self.pattern # :nodoc:
717
726
  Object
718
727
  end
719
728
 
@@ -730,7 +739,7 @@ class OptionParser
730
739
  #
731
740
  # Raises an exception if argument is not present.
732
741
  #
733
- def parse(arg, argv)
742
+ def parse(arg, argv, &_)
734
743
  unless arg
735
744
  raise MissingArgument if argv.empty?
736
745
  arg = argv.shift
@@ -755,7 +764,7 @@ class OptionParser
755
764
  if arg
756
765
  conv_arg(*parse_arg(arg, &error))
757
766
  else
758
- conv_arg(arg)
767
+ omitted_argument conv_arg(arg)
759
768
  end
760
769
  end
761
770
 
@@ -774,13 +783,14 @@ class OptionParser
774
783
  #
775
784
  def parse(arg, argv, &error)
776
785
  if !(val = arg) and (argv.empty? or /\A-./ =~ (val = argv[0]))
777
- return nil, block, nil
786
+ return nil, block
778
787
  end
779
788
  opt = (val = parse_arg(val, &error))[1]
780
789
  val = conv_arg(*val)
781
790
  if opt and !arg
782
791
  argv.shift
783
792
  else
793
+ omitted_argument val
784
794
  val[0] = nil
785
795
  end
786
796
  val
@@ -798,6 +808,8 @@ class OptionParser
798
808
  # matching pattern and converter pair. Also provides summary feature.
799
809
  #
800
810
  class List
811
+ # :nodoc:
812
+
801
813
  # Map from acceptable argument types to pattern and converter pairs.
802
814
  attr_reader :atype
803
815
 
@@ -837,7 +849,7 @@ class OptionParser
837
849
  def accept(t, pat = /.*/m, &block)
838
850
  if pat
839
851
  pat.respond_to?(:match) or
840
- raise TypeError, "has no `match'", ParseError.filter_backtrace(caller(2))
852
+ raise TypeError, "has no 'match'", ParseError.filter_backtrace(caller(2))
841
853
  else
842
854
  pat = t if t.respond_to?(:match)
843
855
  end
@@ -1033,11 +1045,31 @@ XXX
1033
1045
  to << "#compdef #{name}\n"
1034
1046
  to << COMPSYS_HEADER
1035
1047
  visit(:compsys, {}, {}) {|o, d|
1036
- to << %Q[ "#{o}[#{d.gsub(/[\"\[\]]/, '\\\\\&')}]" \\\n]
1048
+ to << %Q[ "#{o}[#{d.gsub(/[\\\"\[\]]/, '\\\\\&')}]" \\\n]
1037
1049
  }
1038
1050
  to << " '*:file:_files' && return 0\n"
1039
1051
  end
1040
1052
 
1053
+ def help_exit
1054
+ if STDOUT.tty? && (pager = ENV.values_at(*%w[RUBY_PAGER PAGER]).find {|e| e && !e.empty?})
1055
+ less = ENV["LESS"]
1056
+ args = [{"LESS" => "#{!less || less.empty? ? '-' : less}Fe"}, pager, "w"]
1057
+ print = proc do |f|
1058
+ f.puts help
1059
+ rescue Errno::EPIPE
1060
+ # pager terminated
1061
+ end
1062
+ if Process.respond_to?(:fork) and false
1063
+ IO.popen("-") {|f| f ? Process.exec(*args, in: f) : print.call(STDOUT)}
1064
+ # unreachable
1065
+ end
1066
+ IO.popen(*args, &print)
1067
+ else
1068
+ puts help
1069
+ end
1070
+ exit
1071
+ end
1072
+
1041
1073
  #
1042
1074
  # Default options for ARGV, which never appear in option summary.
1043
1075
  #
@@ -1049,8 +1081,7 @@ XXX
1049
1081
  #
1050
1082
  Officious['help'] = proc do |parser|
1051
1083
  Switch::NoArgument.new do |arg|
1052
- puts parser.help
1053
- exit
1084
+ parser.help_exit
1054
1085
  end
1055
1086
  end
1056
1087
 
@@ -1129,6 +1160,10 @@ XXX
1129
1160
  default.to_i + 1
1130
1161
  end
1131
1162
  end
1163
+
1164
+ #
1165
+ # See self.inc
1166
+ #
1132
1167
  def inc(*args)
1133
1168
  self.class.inc(*args)
1134
1169
  end
@@ -1167,11 +1202,19 @@ XXX
1167
1202
  def terminate(arg = nil)
1168
1203
  self.class.terminate(arg)
1169
1204
  end
1205
+ #
1206
+ # See #terminate.
1207
+ #
1170
1208
  def self.terminate(arg = nil)
1171
1209
  throw :terminate, arg
1172
1210
  end
1173
1211
 
1174
1212
  @stack = [DefaultList]
1213
+ #
1214
+ # Returns the global top option list.
1215
+ #
1216
+ # Do not use directly.
1217
+ #
1175
1218
  def self.top() DefaultList end
1176
1219
 
1177
1220
  #
@@ -1192,9 +1235,9 @@ XXX
1192
1235
  #
1193
1236
  # Directs to reject specified class argument.
1194
1237
  #
1195
- # +t+:: Argument class specifier, any object including Class.
1238
+ # +type+:: Argument class specifier, any object including Class.
1196
1239
  #
1197
- # reject(t)
1240
+ # reject(type)
1198
1241
  #
1199
1242
  def reject(*args, &blk) top.reject(*args, &blk) end
1200
1243
  #
@@ -1284,10 +1327,24 @@ XXX
1284
1327
  end
1285
1328
  end
1286
1329
 
1330
+ #
1331
+ # Shows warning message with the program name
1332
+ #
1333
+ # +mesg+:: Message, defaulted to +$!+.
1334
+ #
1335
+ # See Kernel#warn.
1336
+ #
1287
1337
  def warn(mesg = $!)
1288
1338
  super("#{program_name}: #{mesg}")
1289
1339
  end
1290
1340
 
1341
+ #
1342
+ # Shows message with the program name then aborts.
1343
+ #
1344
+ # +mesg+:: Message, defaulted to +$!+.
1345
+ #
1346
+ # See Kernel#abort.
1347
+ #
1291
1348
  def abort(mesg = $!)
1292
1349
  super("#{program_name}: #{mesg}")
1293
1350
  end
@@ -1309,6 +1366,9 @@ XXX
1309
1366
  #
1310
1367
  # Pushes a new List.
1311
1368
  #
1369
+ # If a block is given, yields +self+ and returns the result of the
1370
+ # block, otherwise returns +self+.
1371
+ #
1312
1372
  def new
1313
1373
  @stack.push(List.new)
1314
1374
  if block_given?
@@ -1532,6 +1592,12 @@ XXX
1532
1592
  nolong
1533
1593
  end
1534
1594
 
1595
+ # ----
1596
+ # Option definition phase methods
1597
+ #
1598
+ # These methods are used to define options, or to construct an
1599
+ # OptionParser instance in other words.
1600
+
1535
1601
  # :call-seq:
1536
1602
  # define(*params, &block)
1537
1603
  #
@@ -1607,6 +1673,13 @@ XXX
1607
1673
  top.append(string, nil, nil)
1608
1674
  end
1609
1675
 
1676
+ # ----
1677
+ # Arguments parse phase methods
1678
+ #
1679
+ # These methods parse +argv+, convert, and store the results by
1680
+ # calling handlers. As these methods do not modify +self+, +self+
1681
+ # can be frozen.
1682
+
1610
1683
  #
1611
1684
  # Parses command line arguments +argv+ in order. When a block is given,
1612
1685
  # each non-option argument is yielded. When optional +into+ keyword
@@ -1616,21 +1689,21 @@ XXX
1616
1689
  #
1617
1690
  # Returns the rest of +argv+ left unparsed.
1618
1691
  #
1619
- def order(*argv, into: nil, &nonopt)
1692
+ def order(*argv, **keywords, &nonopt)
1620
1693
  argv = argv[0].dup if argv.size == 1 and Array === argv[0]
1621
- order!(argv, into: into, &nonopt)
1694
+ order!(argv, **keywords, &nonopt)
1622
1695
  end
1623
1696
 
1624
1697
  #
1625
1698
  # Same as #order, but removes switches destructively.
1626
1699
  # Non-option arguments remain in +argv+.
1627
1700
  #
1628
- def order!(argv = default_argv, into: nil, &nonopt)
1701
+ def order!(argv = default_argv, into: nil, **keywords, &nonopt)
1629
1702
  setter = ->(name, val) {into[name.to_sym] = val} if into
1630
- parse_in_order(argv, setter, &nonopt)
1703
+ parse_in_order(argv, setter, **keywords, &nonopt)
1631
1704
  end
1632
1705
 
1633
- def parse_in_order(argv = default_argv, setter = nil, &nonopt) # :nodoc:
1706
+ def parse_in_order(argv = default_argv, setter = nil, exact: require_exact, **, &nonopt) # :nodoc:
1634
1707
  opt, arg, val, rest = nil
1635
1708
  nonopt ||= proc {|a| throw :terminate, a}
1636
1709
  argv.unshift(arg) if arg = catch(:terminate) {
@@ -1641,19 +1714,24 @@ XXX
1641
1714
  opt, rest = $1, $2
1642
1715
  opt.tr!('_', '-')
1643
1716
  begin
1644
- sw, = complete(:long, opt, true)
1645
- if require_exact && !sw.long.include?(arg)
1646
- throw :terminate, arg unless raise_unknown
1647
- raise InvalidOption, arg
1717
+ if exact
1718
+ sw, = search(:long, opt)
1719
+ else
1720
+ sw, = complete(:long, opt, true)
1648
1721
  end
1649
1722
  rescue ParseError
1650
1723
  throw :terminate, arg unless raise_unknown
1651
1724
  raise $!.set_option(arg, true)
1725
+ else
1726
+ unless sw
1727
+ throw :terminate, arg unless raise_unknown
1728
+ raise InvalidOption, arg
1729
+ end
1652
1730
  end
1653
1731
  begin
1654
- opt, cb, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
1655
- val = cb.call(val) if cb
1656
- setter.call(sw.switch_name, val) if setter
1732
+ opt, cb, *val = sw.parse(rest, argv) {|*exc| raise(*exc)}
1733
+ val = callback!(cb, 1, *val) if cb
1734
+ callback!(setter, 2, sw.switch_name, *val) if setter
1657
1735
  rescue ParseError
1658
1736
  raise $!.set_option(arg, rest)
1659
1737
  end
@@ -1671,7 +1749,7 @@ XXX
1671
1749
  val = arg.delete_prefix('-')
1672
1750
  has_arg = true
1673
1751
  rescue InvalidOption
1674
- raise if require_exact
1752
+ raise if exact
1675
1753
  # if no short options match, try completion with long
1676
1754
  # options.
1677
1755
  sw, = complete(:long, opt)
@@ -1683,7 +1761,7 @@ XXX
1683
1761
  raise $!.set_option(arg, true)
1684
1762
  end
1685
1763
  begin
1686
- opt, cb, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
1764
+ opt, cb, *val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
1687
1765
  rescue ParseError
1688
1766
  raise $!.set_option(arg, arg.length > 2)
1689
1767
  else
@@ -1691,8 +1769,8 @@ XXX
1691
1769
  end
1692
1770
  begin
1693
1771
  argv.unshift(opt) if opt and (!rest or (opt = opt.sub(/\A-*/, '-')) != '-')
1694
- val = cb.call(val) if cb
1695
- setter.call(sw.switch_name, val) if setter
1772
+ val = callback!(cb, 1, *val) if cb
1773
+ callback!(setter, 2, sw.switch_name, *val) if setter
1696
1774
  rescue ParseError
1697
1775
  raise $!.set_option(arg, arg.length > 2)
1698
1776
  end
@@ -1718,6 +1796,17 @@ XXX
1718
1796
  end
1719
1797
  private :parse_in_order
1720
1798
 
1799
+ # Calls callback with _val_.
1800
+ def callback!(cb, max_arity, *args) # :nodoc:
1801
+ if (size = args.size) < max_arity and cb.to_proc.lambda?
1802
+ (arity = cb.arity) < 0 and arity = (1-arity)
1803
+ arity = max_arity if arity > max_arity
1804
+ args[arity - 1] = nil if arity > size
1805
+ end
1806
+ cb.call(*args)
1807
+ end
1808
+ private :callback!
1809
+
1721
1810
  #
1722
1811
  # Parses command line arguments +argv+ in permutation mode and returns
1723
1812
  # list of non-option arguments. When optional +into+ keyword
@@ -1725,18 +1814,18 @@ XXX
1725
1814
  # <code>[]=</code> method (so it can be Hash, or OpenStruct, or other
1726
1815
  # similar object).
1727
1816
  #
1728
- def permute(*argv, into: nil)
1817
+ def permute(*argv, **keywords)
1729
1818
  argv = argv[0].dup if argv.size == 1 and Array === argv[0]
1730
- permute!(argv, into: into)
1819
+ permute!(argv, **keywords)
1731
1820
  end
1732
1821
 
1733
1822
  #
1734
1823
  # Same as #permute, but removes switches destructively.
1735
1824
  # Non-option arguments remain in +argv+.
1736
1825
  #
1737
- def permute!(argv = default_argv, into: nil)
1826
+ def permute!(argv = default_argv, **keywords)
1738
1827
  nonopts = []
1739
- order!(argv, into: into, &nonopts.method(:<<))
1828
+ order!(argv, **keywords, &nonopts.method(:<<))
1740
1829
  argv[0, 0] = nonopts
1741
1830
  argv
1742
1831
  end
@@ -1748,20 +1837,20 @@ XXX
1748
1837
  # values are stored there via <code>[]=</code> method (so it can be Hash,
1749
1838
  # or OpenStruct, or other similar object).
1750
1839
  #
1751
- def parse(*argv, into: nil)
1840
+ def parse(*argv, **keywords)
1752
1841
  argv = argv[0].dup if argv.size == 1 and Array === argv[0]
1753
- parse!(argv, into: into)
1842
+ parse!(argv, **keywords)
1754
1843
  end
1755
1844
 
1756
1845
  #
1757
1846
  # Same as #parse, but removes switches destructively.
1758
1847
  # Non-option arguments remain in +argv+.
1759
1848
  #
1760
- def parse!(argv = default_argv, into: nil)
1849
+ def parse!(argv = default_argv, **keywords)
1761
1850
  if ENV.include?('POSIXLY_CORRECT')
1762
- order!(argv, into: into)
1851
+ order!(argv, **keywords)
1763
1852
  else
1764
- permute!(argv, into: into)
1853
+ permute!(argv, **keywords)
1765
1854
  end
1766
1855
  end
1767
1856
 
@@ -1775,7 +1864,16 @@ XXX
1775
1864
  # # params["bar"] = "x" # --bar x
1776
1865
  # # params["zot"] = "z" # --zot Z
1777
1866
  #
1778
- def getopts(*args)
1867
+ # Option +symbolize_names+ (boolean) specifies whether returned Hash keys should be Symbols; defaults to +false+ (use Strings).
1868
+ #
1869
+ # params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option", symbolize_names: true)
1870
+ # # params[:a] = true # -a
1871
+ # # params[:b] = "1" # -b1
1872
+ # # params[:foo] = "1" # --foo
1873
+ # # params[:bar] = "x" # --bar x
1874
+ # # params[:zot] = "z" # --zot Z
1875
+ #
1876
+ def getopts(*args, symbolize_names: false, **keywords)
1779
1877
  argv = Array === args.first ? args.shift : default_argv
1780
1878
  single_options, *long_options = *args
1781
1879
 
@@ -1803,15 +1901,15 @@ XXX
1803
1901
  end
1804
1902
  end
1805
1903
 
1806
- parse_in_order(argv, result.method(:[]=))
1807
- result
1904
+ parse_in_order(argv, result.method(:[]=), **keywords)
1905
+ symbolize_names ? result.transform_keys(&:to_sym) : result
1808
1906
  end
1809
1907
 
1810
1908
  #
1811
1909
  # See #getopts.
1812
1910
  #
1813
- def self.getopts(*args)
1814
- new.getopts(*args)
1911
+ def self.getopts(*args, symbolize_names: false)
1912
+ new.getopts(*args, symbolize_names: symbolize_names)
1815
1913
  end
1816
1914
 
1817
1915
  #
@@ -1872,6 +1970,9 @@ XXX
1872
1970
  DidYouMean.formatter.message_for(all_candidates & checker.correct(opt))
1873
1971
  end
1874
1972
 
1973
+ #
1974
+ # Return candidates for +word+.
1975
+ #
1875
1976
  def candidate(word)
1876
1977
  list = []
1877
1978
  case word
@@ -1913,10 +2014,10 @@ XXX
1913
2014
  # The optional +into+ keyword argument works exactly like that accepted in
1914
2015
  # method #parse.
1915
2016
  #
1916
- def load(filename = nil, into: nil)
2017
+ def load(filename = nil, **keywords)
1917
2018
  unless filename
1918
2019
  basename = File.basename($0, '.*')
1919
- return true if load(File.expand_path(basename, '~/.options'), into: into) rescue nil
2020
+ return true if load(File.expand_path(basename, '~/.options'), **keywords) rescue nil
1920
2021
  basename << ".options"
1921
2022
  return [
1922
2023
  # XDG
@@ -1928,11 +2029,11 @@ XXX
1928
2029
  '~/config/settings',
1929
2030
  ].any? {|dir|
1930
2031
  next if !dir or dir.empty?
1931
- load(File.expand_path(basename, dir), into: into) rescue nil
2032
+ load(File.expand_path(basename, dir), **keywords) rescue nil
1932
2033
  }
1933
2034
  end
1934
2035
  begin
1935
- parse(*File.readlines(filename, chomp: true), into: into)
2036
+ parse(*File.readlines(filename, chomp: true), **keywords)
1936
2037
  true
1937
2038
  rescue Errno::ENOENT, Errno::ENOTDIR
1938
2039
  false
@@ -1945,10 +2046,10 @@ XXX
1945
2046
  #
1946
2047
  # +env+ defaults to the basename of the program.
1947
2048
  #
1948
- def environment(env = File.basename($0, '.*'))
2049
+ def environment(env = File.basename($0, '.*'), **keywords)
1949
2050
  env = ENV[env] || ENV[env.upcase] or return
1950
2051
  require 'shellwords'
1951
- parse(*Shellwords.shellwords(env))
2052
+ parse(*Shellwords.shellwords(env), **keywords)
1952
2053
  end
1953
2054
 
1954
2055
  #
@@ -2114,6 +2215,7 @@ XXX
2114
2215
  # Reason which caused the error.
2115
2216
  Reason = 'parse error'
2116
2217
 
2218
+ # :nodoc:
2117
2219
  def initialize(*args, additional: nil)
2118
2220
  @additional = additional
2119
2221
  @arg0, = args
@@ -2264,19 +2366,19 @@ XXX
2264
2366
  # Parses +self+ destructively in order and returns +self+ containing the
2265
2367
  # rest arguments left unparsed.
2266
2368
  #
2267
- def order!(&blk) options.order!(self, &blk) end
2369
+ def order!(**keywords, &blk) options.order!(self, **keywords, &blk) end
2268
2370
 
2269
2371
  #
2270
2372
  # Parses +self+ destructively in permutation mode and returns +self+
2271
2373
  # containing the rest arguments left unparsed.
2272
2374
  #
2273
- def permute!() options.permute!(self) end
2375
+ def permute!(**keywords) options.permute!(self, **keywords) end
2274
2376
 
2275
2377
  #
2276
2378
  # Parses +self+ destructively and returns +self+ containing the
2277
2379
  # rest arguments left unparsed.
2278
2380
  #
2279
- def parse!() options.parse!(self) end
2381
+ def parse!(**keywords) options.parse!(self, **keywords) end
2280
2382
 
2281
2383
  #
2282
2384
  # Substitution of getopts is possible as follows. Also see
@@ -2289,8 +2391,8 @@ XXX
2289
2391
  # rescue OptionParser::ParseError
2290
2392
  # end
2291
2393
  #
2292
- def getopts(*args)
2293
- options.getopts(self, *args)
2394
+ def getopts(*args, symbolize_names: false, **keywords)
2395
+ options.getopts(self, *args, symbolize_names: symbolize_names, **keywords)
2294
2396
  end
2295
2397
 
2296
2398
  #
@@ -2300,7 +2402,8 @@ XXX
2300
2402
  super
2301
2403
  obj.instance_eval {@optparse = nil}
2302
2404
  end
2303
- def initialize(*args)
2405
+
2406
+ def initialize(*args) # :nodoc:
2304
2407
  super
2305
2408
  @optparse = nil
2306
2409
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optparse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobu Nakada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-22 00:00:00.000000000 Z
11
+ date: 2024-04-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: OptionParser is a class for command-line option analysis.
14
14
  email:
@@ -17,12 +17,16 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".document"
21
+ - ".rdoc_options"
20
22
  - COPYING
21
23
  - ChangeLog
22
24
  - README.md
25
+ - doc/optparse/.document
23
26
  - doc/optparse/argument_converters.rdoc
24
27
  - doc/optparse/creates_option.rdoc
25
28
  - doc/optparse/option_params.rdoc
29
+ - doc/optparse/ruby/argument_abbreviation.rb
26
30
  - doc/optparse/ruby/argument_keywords.rb
27
31
  - doc/optparse/ruby/argument_strings.rb
28
32
  - doc/optparse/ruby/argv.rb
@@ -115,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
119
  - !ruby/object:Gem::Version
116
120
  version: '0'
117
121
  requirements: []
118
- rubygems_version: 3.4.0.dev
122
+ rubygems_version: 3.5.3
119
123
  signing_key:
120
124
  specification_version: 4
121
125
  summary: OptionParser is a class for command-line option analysis.