summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKouhei Yanagita <[email protected]>2024-11-29 11:10:07 +0900
committerHiroshi SHIBATA <[email protected]>2024-12-02 08:28:58 +0900
commitae59b44041d118514d6ac835e3b34f8a1a72e198 (patch)
tree213b621b57719aef404c13e43c0454793fac1f70 /lib
parentf2334cf4b1fe3b903a17c46004e9dc9127397da7 (diff)
[ruby/set] Fix ^ to respect subclasses
https://github.com/ruby/set/commit/f88ecdef6b
Diffstat (limited to 'lib')
-rw-r--r--lib/set.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/set.rb b/lib/set.rb
index ecf89c5c16..26311af6cc 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -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