[前][次][番号順一覧][スレッド一覧]

ruby-changes:8707

From: nobu <ko1@a...>
Date: Tue, 18 Nov 2008 09:42:39 +0900 (JST)
Subject: [ruby-changes:8707] Ruby:r20242 (trunk, ruby_1_8): * lib/optparse.rb (OptionParser::make_switch): makes default

nobu	2008-11-18 09:42:18 +0900 (Tue, 18 Nov 2008)

  New Revision: 20242

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20242

  Log:
    * lib/optparse.rb (OptionParser::make_switch): makes default
      conversion to splat.  [ruby-list:45645]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/optparse.rb
    branches/ruby_1_8/version.h
    trunk/ChangeLog
    trunk/lib/optparse.rb
    trunk/version.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20241)
+++ ChangeLog	(revision 20242)
@@ -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: lib/optparse.rb
===================================================================
--- lib/optparse.rb	(revision 20241)
+++ lib/optparse.rb	(revision 20242)
@@ -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
 
Index: version.h
===================================================================
--- version.h	(revision 20241)
+++ version.h	(revision 20242)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-11-17"
+#define RUBY_RELEASE_DATE "2008-11-18"
 #define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20081117
+#define RUBY_RELEASE_CODE 20081118
 #define RUBY_PATCHLEVEL 0
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 0
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 17
+#define RUBY_RELEASE_DAY 18
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 20241)
+++ ruby_1_8/ChangeLog	(revision 20242)
@@ -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 02:19:03 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (LIBRUBYARG_STATIC): fixed for --enable-rpath.
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 20241)
+++ ruby_1_8/version.h	(revision 20242)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2008-11-17"
+#define RUBY_RELEASE_DATE "2008-11-18"
 #define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20081117
+#define RUBY_RELEASE_CODE 20081118
 #define RUBY_PATCHLEVEL 5000
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 7
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 17
+#define RUBY_RELEASE_DAY 18
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8/lib/optparse.rb
===================================================================
--- ruby_1_8/lib/optparse.rb	(revision 20241)
+++ ruby_1_8/lib/optparse.rb	(revision 20242)
@@ -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.
@@ -1077,7 +1078,11 @@
       # directly specified pattern(any object possible to match)
       if !(String === 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/

[前][次][番号順一覧][スレッド一覧]