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

ruby-changes:24702

From: usa <ko1@a...>
Date: Tue, 21 Aug 2012 15:53:51 +0900 (JST)
Subject: [ruby-changes:24702] usa:r36753 (trunk): * ext/dl/lib/dl/func.rb (DL::Function#bind): fixes an error in

usa	2012-08-21 15:53:40 +0900 (Tue, 21 Aug 2012)

  New Revision: 36753

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

  Log:
    * ext/dl/lib/dl/func.rb (DL::Function#bind): fixes an error in
      test/dl/test_import.rb (DL::TestImport#test_carried_function)
      introduced by r36718.
      the instance of the anonymous class which wraps the block should have
      same methods and instance variables of self.

  Modified files:
    trunk/ChangeLog
    trunk/ext/dl/lib/dl/func.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36752)
+++ ChangeLog	(revision 36753)
@@ -1,3 +1,11 @@
+Tue Aug 21 15:44:27 2012  NAKAMURA Usaku  <usa@r...>
+
+	* ext/dl/lib/dl/func.rb (DL::Function#bind): fixes an error in
+	  test/dl/test_import.rb (DL::TestImport#test_carried_function)
+	  introduced by r36718.
+	  the instance of the anonymous class which wraps the block should have
+	  same methods and instance variables of self.
+
 Tue Aug 21 14:29:22 2012  NAKAMURA Usaku  <usa@r...>
 
 	* win32/Makefile.sub (scriptbin.mk): no need to include twice.
Index: ext/dl/lib/dl/func.rb
===================================================================
--- ext/dl/lib/dl/func.rb	(revision 36752)
+++ ext/dl/lib/dl/func.rb	(revision 36753)
@@ -91,7 +91,7 @@
           raise(RuntimeError, "block must be given.")
         end
         unless block.lambda?
-          block = Class.new{define_method(:call, block)}.new.method(:call)
+          block = Class.new(self.class){define_method(:call, block); def initialize(obj); obj.instance_variables.each{|s| instance_variable_set(s, obj.instance_variable_get(s))}; end}.new(self).method(:call)
         end
         if( @cfunc.ptr == 0 )
           cb = Proc.new{|*args|

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

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