From 72ef219804e5524848170a197887a95718334e2a Mon Sep 17 00:00:00 2001 From: knu Date: Sun, 10 Oct 2010 09:45:36 +0000 Subject: * 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 --- lib/set.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 lib/set.rb (limited to 'lib/set.rb') diff --git a/lib/set.rb b/lib/set.rb old mode 100644 new mode 100755 index 5e4e0878bd..5655c263ba --- 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) -- cgit v1.2.3