Method: Weak::Set#superset?

Defined in:
lib/weak/set.rb

#superset?(other) ⇒ Bool Also known as: >=

Returns true if self is a superset of the given set, false otherwise.

Parameters:

Returns:

  • (Bool)

    true if self is a superset of the given set, false otherwise

See Also:



686
687
688
689
690
691
692
693
694
695
696
# File 'lib/weak/set.rb', line 686

def superset?(other)
  if Weak::Set === other
    other_ary = other.to_a
    own_ary = to_a

    return false unless own_ary.size >= other_ary.size
    other_ary.all?(self)
  else
    raise ArgumentError, "value must be a weak set"
  end
end