Method: Weak::Set#subset?
- Defined in:
- lib/weak/set.rb
#subset?(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 subset of the given set, false
otherwise.
657 658 659 660 661 662 663 664 665 666 667 |
# File 'lib/weak/set.rb', line 657 def 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 |