mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
8dded0725b
commit
f7b562ef01
2 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Fri May 1 16:50:05 2009 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* 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]
|
||||||
|
|
||||||
Fri May 1 16:44:11 2009 Akinori MUSHA <knu@iDaemons.org>
|
Fri May 1 16:44:11 2009 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* lib/set.rb (SortedSet#add): Do not let an uncomparable object
|
* lib/set.rb (SortedSet#add): Do not let an uncomparable object
|
||||||
|
|
|
@ -276,8 +276,8 @@ class Set
|
||||||
# Merges the elements of the given enumerable object to the set and
|
# Merges the elements of the given enumerable object to the set and
|
||||||
# returns self.
|
# returns self.
|
||||||
def merge(enum)
|
def merge(enum)
|
||||||
if enum.is_a?(Set)
|
if enum.instance_of?(self.class)
|
||||||
@hash.update(enum.instance_eval { @hash })
|
@hash.update(enum.instance_variable_get(:@hash))
|
||||||
else
|
else
|
||||||
enum.each { |o| add(o) }
|
enum.each { |o| add(o) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue