summaryrefslogtreecommitdiff
path: root/lib/optparse.rb
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 16:36:30 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 16:36:30 +0000
commit78c56ae5840c4d41a6d6c7a38c023982c2ab3637 (patch)
tree95b8d039d8a3fdba714a573b6f06e2db2fc8e62d /lib/optparse.rb
parenta756488c6d3a9a0d0fab76cd4c67e655f00c399b (diff)
* 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
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r--lib/optparse.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 9648f75fd2..469fde29ae 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -111,7 +111,7 @@
# options.transfer_type = :auto
# options.verbose = false
#
-# opts = OptionParser.new do |opts|
+# opt_parser = OptionParser.new do |opts|
# opts.banner = "Usage: example.rb [options]"
#
# opts.separator ""
@@ -190,7 +190,7 @@
# end
# end
#
-# opts.parse!(args)
+# opt_parser.parse!(args)
# options
# end # parse()
#
@@ -198,6 +198,7 @@
#
# options = OptparseExample.parse(ARGV)
# pp options
+# pp ARGV
#
# === Shell Completion
#
@@ -1338,6 +1339,7 @@ XXX
#
# Same as #order, but removes switches destructively.
+ # Non-option arguments remain in +argv+.
#
def order!(argv = default_argv, &nonopt)
parse_in_order(argv, &nonopt)
@@ -1428,6 +1430,7 @@ XXX
#
# Same as #permute, but removes switches destructively.
+ # Non-option arguments remain in +argv+.
#
def permute!(argv = default_argv)
nonopts = []
@@ -1447,6 +1450,7 @@ XXX
#
# Same as #parse, but removes switches destructively.
+ # Non-option arguments remain in +argv+.
#
def parse!(argv = default_argv)
if ENV.include?('POSIXLY_CORRECT')