mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
parent
f2334cf4b1
commit
ae59b44041
2 changed files with 6 additions and 1 deletions
|
@ -662,7 +662,7 @@ class Set
|
|||
# Set[1, 2] ^ Set[2, 3] #=> #<Set: {3, 1}>
|
||||
# Set[1, 'b', 'c'] ^ ['b', 'd'] #=> #<Set: {"d", 1, "c"}>
|
||||
def ^(enum)
|
||||
n = Set.new(enum)
|
||||
n = self.class.new(enum)
|
||||
each { |o| n.add(o) unless n.delete?(o) }
|
||||
n
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue