Class: Sift::SubsetComparator

Inherits:
Object
  • Object
show all
Defined in:
lib/sift/subset_comparator.rb

Instance Method Summary collapse

Constructor Details

#initialize(array) ⇒ SubsetComparator

Returns a new instance of SubsetComparator.



3
4
5
# File 'lib/sift/subset_comparator.rb', line 3

def initialize(array)
  @array = array
end

Instance Method Details

#include?(other) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/sift/subset_comparator.rb', line 7

def include?(other)
  other = [other] unless other.is_a?(Array)

  @array.to_set >= other.to_set
end