* lib/optparse.rb: Documentation for OptionParser to remove 'shadowed

outer local variable' from example and make obvious ARGV with
  non-option arguments.
  Patch by Marcus Stollsteimer [ruby-core:47460] [Bug #6997]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2012-12-22 16:36:30 +00:00
parent a756488c6d
commit 78c56ae584
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,10 @@
Sat Dec 23 01:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
* lib/optparse.rb: Documentation for OptionParser to remove 'shadowed
outer local variable' from example and make obvious ARGV with
non-option arguments.
Patch by Marcus Stollsteimer [ruby-core:47460] [Bug #6997]
Sat Dec 23 00:08:00 2012 Kenta Murata <mrkn@mrkn.jp> Sat Dec 23 00:08:00 2012 Kenta Murata <mrkn@mrkn.jp>
* include/ruby/intern.h: add the prototype declaration of * include/ruby/intern.h: add the prototype declaration of

View File

@ -111,7 +111,7 @@
# options.transfer_type = :auto # options.transfer_type = :auto
# options.verbose = false # options.verbose = false
# #
# opts = OptionParser.new do |opts| # opt_parser = OptionParser.new do |opts|
# opts.banner = "Usage: example.rb [options]" # opts.banner = "Usage: example.rb [options]"
# #
# opts.separator "" # opts.separator ""
@ -190,7 +190,7 @@
# end # end
# end # end
# #
# opts.parse!(args) # opt_parser.parse!(args)
# options # options
# end # parse() # end # parse()
# #
@ -198,6 +198,7 @@
# #
# options = OptparseExample.parse(ARGV) # options = OptparseExample.parse(ARGV)
# pp options # pp options
# pp ARGV
# #
# === Shell Completion # === Shell Completion
# #
@ -1338,6 +1339,7 @@ XXX
# #
# Same as #order, but removes switches destructively. # Same as #order, but removes switches destructively.
# Non-option arguments remain in +argv+.
# #
def order!(argv = default_argv, &nonopt) def order!(argv = default_argv, &nonopt)
parse_in_order(argv, &nonopt) parse_in_order(argv, &nonopt)
@ -1428,6 +1430,7 @@ XXX
# #
# Same as #permute, but removes switches destructively. # Same as #permute, but removes switches destructively.
# Non-option arguments remain in +argv+.
# #
def permute!(argv = default_argv) def permute!(argv = default_argv)
nonopts = [] nonopts = []
@ -1447,6 +1450,7 @@ XXX
# #
# Same as #parse, but removes switches destructively. # Same as #parse, but removes switches destructively.
# Non-option arguments remain in +argv+.
# #
def parse!(argv = default_argv) def parse!(argv = default_argv)
if ENV.include?('POSIXLY_CORRECT') if ENV.include?('POSIXLY_CORRECT')