ruby-changes:26510
From: zzak <ko1@a...>
Date: Sun, 23 Dec 2012 01:36:42 +0900 (JST)
Subject: [ruby-changes:26510] zzak:r38561 (trunk): * lib/optparse.rb: Documentation for OptionParser to remove 'shadowed
zzak 2012-12-23 01:36:30 +0900 (Sun, 23 Dec 2012) New Revision: 38561 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38561 Log: * 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] Modified files: trunk/ChangeLog trunk/lib/optparse.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38560) +++ ChangeLog (revision 38561) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Dec 23 01:35:00 2012 Zachary Scott <zachary@z...> + + * 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@m...> * include/ruby/intern.h: add the prototype declaration of Index: lib/optparse.rb =================================================================== --- lib/optparse.rb (revision 38560) +++ lib/optparse.rb (revision 38561) @@ -111,7 +111,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L111 # 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 @@ https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L190 # end # end # -# opts.parse!(args) +# opt_parser.parse!(args) # options # end # parse() # @@ -198,6 +198,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L198 # # options = OptparseExample.parse(ARGV) # pp options +# pp ARGV # # === Shell Completion # @@ -1338,6 +1339,7 @@ XXX https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L1339 # # 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 https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L1430 # # Same as #permute, but removes switches destructively. + # Non-option arguments remain in +argv+. # def permute!(argv = default_argv) nonopts = [] @@ -1447,6 +1450,7 @@ XXX https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L1450 # # Same as #parse, but removes switches destructively. + # Non-option arguments remain in +argv+. # def parse!(argv = default_argv) if ENV.include?('POSIXLY_CORRECT') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/