class Set
no-doc
Public Instance Methods
disjoint?(set)
click to toggle source
Returns true if the set and the given set have no element in common. This method is the opposite of intersect?. www.ruby-doc.org/stdlib-2.2.0/libdoc/set/rdoc/Set.html#method-i-disjoint-3F
# File lib/graph_matching/core_ext/set.rb, line 31 def disjoint?(set) !intersect?(set) end
intersect?(set)
click to toggle source
Returns true if the set and the given set have at least one element in common. www.ruby-doc.org/stdlib-2.2.0/libdoc/set/rdoc/Set.html#method-i-intersect-3F
# File lib/graph_matching/core_ext/set.rb, line 17 def intersect?(set) unless set.is_a?(Set) raise ArgumentError, 'value must be a set' end if size < set.size any? { |o| set.include?(o) } else set.any? { |o| include?(o) } end end