public Method

Set.replace(enum)

Replaces the contents of the set with the contents of the given enumerable object and returns self.

Source Code

# File set.rb, line 100
def replace(enum)
  if enum.class == self.class
    @hash.replace(enum.instance_eval { @hash })
  else
    enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
    clear
    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.