Method: Weak::Set#proper_superset?

Defined in:
lib/weak/set.rb

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

Note:

Weak::Set does not test member equality with == or eql?. Instead, it always checks strict object equality, so that, e.g., different strings are not considered equal, even if they may contain the same string content.

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

Parameters:

Returns:

  • (Bool)

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

See Also:



590
591
592
593
594
595
596
597
598
599
600
# File 'lib/weak/set.rb', line 590

def proper_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