ruby-changes:8733
From: yugui <ko1@a...>
Date: Wed, 19 Nov 2008 01:48:35 +0900 (JST)
Subject: [ruby-changes:8733] Ruby:r20269 (ruby_1_9_1): merges r20242 from trunk into ruby_1_9_1. recovers 1.8-compatible
yugui 2008-11-19 01:48:15 +0900 (Wed, 19 Nov 2008) New Revision: 20269 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20269 Log: merges r20242 from trunk into ruby_1_9_1. recovers 1.8-compatible parsing for OptionParser. * lib/optparse.rb (OptionParser::make_switch): makes default conversion to splat. [ruby-list:45645] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/lib/optparse.rb Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20268) +++ ruby_1_9_1/ChangeLog (revision 20269) @@ -1,3 +1,8 @@ +Tue Nov 18 09:42:11 2008 Nobuyoshi Nakada <nobu@r...> + + * lib/optparse.rb (OptionParser::make_switch): makes default + conversion to splat. [ruby-list:45645] + Mon Nov 17 18:05:16 2008 Nobuyoshi Nakada <nobu@r...> * enc/depend (LIBS): fixed for disable-shared. [ruby-dev:37103] Index: ruby_1_9_1/lib/optparse.rb =================================================================== --- ruby_1_9_1/lib/optparse.rb (revision 20268) +++ ruby_1_9_1/lib/optparse.rb (revision 20269) @@ -996,6 +996,7 @@ end private :notwice + SPLAT_PROC = proc {|*a| a} # # Creates an OptionParser::Switch from the parameters. The parsed argument # value is passed to the given block, where it can be processed. @@ -1076,7 +1077,11 @@ # directly specified pattern(any object possible to match) if (!(String === o || Symbol === o)) and o.respond_to?(:match) pattern = notwice(o, pattern, 'pattern') - conv = pattern.method(:convert).to_proc if pattern.respond_to?(:convert) + if pattern.respond_to?(:convert) + conv = pattern.method(:convert).to_proc + else + conv = SPLAT_PROC + end next end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/