Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Set#merge
merge(*enums, **nil)
lib/set.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/set.rb, line 595
def merge(*enums, **nil)
enums.each do |enum|
if enum.instance_of?(self.class)
@hash.update(enum.instance_variable_get(:@hash))
else
do_with_enum(enum) { |o| add(o) }
end
end
self
end
Merges the elements of the given enumerable objects to the set and returns self.