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

ruby-changes:14200

From: yugui <ko1@a...>
Date: Sat, 5 Dec 2009 18:49:42 +0900 (JST)
Subject: [ruby-changes:14200] Ruby:r26021 (ruby_1_9_1): * lib/irb/extend-command.rb (IRB::ExtendCommandBundle::def_extend_command):

yugui	2009-12-05 18:41:18 +0900 (Sat, 05 Dec 2009)

  New Revision: 26021

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

  Log:
    * lib/irb/extend-command.rb (IRB::ExtendCommandBundle::def_extend_command):
      extension commands with optional parameters have been broken because of
      a spec change of UnboundMethod#arity.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/lib/irb/extend-command.rb
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 26020)
+++ ruby_1_9_1/ChangeLog	(revision 26021)
@@ -1,3 +1,9 @@
+Sat Dec  5 14:29:49 2009  Yuki Sonoda (Yugui)  <yugui@y...>
+
+	* lib/irb/extend-command.rb (IRB::ExtendCommandBundle::def_extend_command):
+	  extension commands with optional parameters have been broken because of 
+	  a spec change of UnboundMethod#arity.
+
 Sat Dec  5 14:24:10 2009  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	* lib/irb/extend-command.rb (IRB::ExtendCommandBundle::def_extend_command):
Index: ruby_1_9_1/lib/irb/extend-command.rb
===================================================================
--- ruby_1_9_1/lib/irb/extend-command.rb	(revision 26020)
+++ ruby_1_9_1/lib/irb/extend-command.rb	(revision 26021)
@@ -126,8 +126,12 @@
 	  def #{cmd_name}(*opts, &b)
 	    require "#{load_file}"
 	    arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity
-	    args = (1..arity).map {|i| "arg" + i.to_s }
-	    args << "*opts" if arity < 0
+            args = []
+	    if arity < 0
+	      args << "*opts"
+	      arity = -arity - 1
+	    end
+	    args.unshift *(1..arity).map {|i| "arg" + i.to_s }
 	    args << "&block"
 	    args = args.join(", ")
 	    eval <<-"EOS2", binding, __FILE__, __LINE__+1
Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 26020)
+++ ruby_1_9_1/version.h	(revision 26021)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.1"
-#define RUBY_PATCHLEVEL 374
+#define RUBY_PATCHLEVEL 375
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

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