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

ruby-changes:17429

From: knu <ko1@a...>
Date: Sun, 10 Oct 2010 18:56:24 +0900 (JST)
Subject: [ruby-changes:17429] Ruby:r29434 (trunk): * lib/set.rb (Set#replace): Apply a bit of optimization.

knu	2010-10-10 18:45:36 +0900 (Sun, 10 Oct 2010)

  New Revision: 29434

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

  Log:
    * lib/set.rb (Set#replace): Apply a bit of optimization.

  Modified files:
    trunk/ChangeLog
    trunk/lib/set.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29433)
+++ ChangeLog	(revision 29434)
@@ -1,3 +1,7 @@
+Sun Oct 10 18:42:23 2010  Akinori MUSHA  <knu@i...>
+
+	* lib/set.rb (Set#replace): Apply a bit of optimization.
+
 Sun Oct 10 10:20:07 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (RUBY_MINGW32): canonicalize as like mswin version.
Index: lib/set.rb
===================================================================
--- lib/set.rb	(revision 29433)
+++ lib/set.rb	(revision 29434)
@@ -130,8 +130,8 @@
   # Replaces the contents of the set with the contents of the given
   # enumerable object and returns self.
   def replace(enum)
-    if enum.class == self.class
-      @hash.replace(enum.instance_eval { @hash })
+    if enum.instance_of?(self.class)
+      @hash.replace(enum.instance_variable_get(:@hash))
     else
       clear
       merge(enum)

Property changes on: lib/set.rb
___________________________________________________________________
Added: svn:executable
   + *


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

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