diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-01 07:52:09 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-01 07:52:09 +0000 |
commit | f7b562ef0114d8421d7d1cc6595e0c056feada8f (patch) | |
tree | fc2f5077f82c31f40f634e83da9acb58e47f55c0 /lib/set.rb | |
parent | 8dded0725b1ed215c8da1131a132b4ca6eb2f434 (diff) |
* lib/set.rb (Set#merge): Only directly use the passed objects
@hash instance variable when self and the passed object are
instances of the same class. [Bug #118]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/set.rb')
-rw-r--r-- | lib/set.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/set.rb b/lib/set.rb index ec42b93fab..5be2bce76a 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -276,8 +276,8 @@ class Set # Merges the elements of the given enumerable object to the set and # returns self. def merge(enum) - if enum.is_a?(Set) - @hash.update(enum.instance_eval { @hash }) + if enum.instance_of?(self.class) + @hash.update(enum.instance_variable_get(:@hash)) else enum.each { |o| add(o) } end |