public Method

Set.&(enum)

Returns a new set containing elements common to the set and the given enumerable object.

Source Code

# File set.rb, line 291
def &(enum)
  enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
  n = self.class.new
  enum.each { |o| n.add(o) if include?(o) }
  n
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.