diff options
author | BurdetteLamar <[email protected]> | 2021-03-28 12:24:21 -0500 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-03-29 15:55:41 +0900 |
commit | 7846f3201a1381cf07ff7477b8a1d6744a853c78 () | |
tree | 166e4cce81ceec6b090dd9b93eb00171a23e568c /lib/optparse.rb | |
parent | eca8ffaa0b446db0a1cacc82a2e73155f6fd3fce (diff) |
[ruby/optparse] Change *opts to *params, to avoid confusion
https://.com/ruby/optparse/commit/f5f5e202dd
-rw-r--r-- | lib/optparse.rb | 45 |
1 files changed, 32 insertions, 13 deletions
@@ -72,10 +72,10 @@ # require 'optparse' # # options = {} -# OptionParser.new do |opts| -# opts.banner = "Usage: example.rb [options]" # -# opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| # options[:verbose] = v # end # end.parse! @@ -96,15 +96,15 @@ # def self.parse(options) # args = Options.new("world") # -# opt_parser = OptionParser.new do |opts| -# opts.banner = "Usage: example.rb [options]" # -# opts.on("-nNAME", "--name=NAME", "Name to say hello to") do |n| # args.name = n # end # -# opts.on("-h", "--help", "Prints this help") do -# puts opts # exit # end # end @@ -241,10 +241,10 @@ # require 'optparse' # # params = {} -# OptionParser.new do |opts| -# opts.on('-a') -# opts.on('-b NUM', Integer) -# opts.on('-v', '--verbose') # end.parse!(into: params) # # p params @@ -1310,13 +1310,16 @@ XXX private :notwice SPLAT_PROC = proc {|*a| a.length <= 1 ? a.first : a} # :nodoc: # # Creates an OptionParser::Switch from the parameters. The parsed argument # value is passed to the given block, where it can be processed. # # See at the beginning of OptionParser for some full examples. # - # +opts+ can include the following elements: # # [Argument style:] # One of the following: @@ -1503,11 +1506,16 @@ XXX nolong end def define(*opts, &block) top.append(*(sw = make_switch(opts, block))) sw[0] end # # Add option switch and handler. See #make_switch for an explanation of # parameters. @@ -1518,11 +1526,16 @@ XXX end alias def_option define def define_head(*opts, &block) top.prepend(*(sw = make_switch(opts, block))) sw[0] end # # Add option switch like with #on, but at head of summary. # @@ -1532,12 +1545,18 @@ XXX end alias def_head_option define_head def define_tail(*opts, &block) base.append(*(sw = make_switch(opts, block))) sw[0] end # # Add option switch like with #on, but at tail of summary. # def on_tail(*opts, &block) |