Method: Weak::Set#proper_subset?

Defined in:
lib/weak/set.rb

#proper_subset?(other) ⇒ Bool Also known as: <

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

Parameters:

Returns:

  • (Bool)

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

See Also:



572
573
574
575
576
577
578
579
580
581
582
# File 'lib/weak/set.rb', line 572

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

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