Method: Set#merge

Defined in:
lib/set.rb

#merge(*enums) ⇒ Object

Merges the elements of the given enumerable objects to the set and returns self.



598
599
600
601
602
603
604
605
606
607
608
# File 'lib/set.rb', line 598

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