aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-10 09:45:36 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-10 09:45:36 +0000
commit72ef219804e5524848170a197887a95718334e2a (patch)
tree6e06124b449369c5b82b6926229353e6c1edfb85
parent3ec721b9c2a382185b76ebadef317c85e85d9558 (diff)
downloadruby-72ef219804e5524848170a197887a95718334e2a.tar.gz
* lib/set.rb (Set#replace): Apply a bit of optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rwxr-xr-x[-rw-r--r--]lib/set.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ebd9702222..8edf692b7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Oct 10 18:42:23 2010 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#replace): Apply a bit of optimization.
+
Sun Oct 10 10:20:07 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_MINGW32): canonicalize as like mswin version.
diff --git a/lib/set.rb b/lib/set.rb
index 5e4e0878bd..5655c263ba 100644..100755
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -130,8 +130,8 @@ class Set
# 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)