public Method

Set.merge(enum)

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

Source Code

# File set.rb, line 253
def merge(enum)
  if enum.is_a?(Set)
    @hash.update(enum.instance_eval { @hash })
  else
    enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
    enum.each { |o| add(o) }
  end

  self
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.