Sha256: b45e7c748cb07b8a3cb73a408dcd66687f79ee817841b95bdf40d2e74679ff20

Contents?: true

Size: 403 Bytes

Versions: 5

Compression:

Stored size: 403 Bytes

Contents

module TreeClusters
  # Provides convenience methods for working with Arrays of Sets
  class AttrArray < Object::Array
    # Takes the union of all sets in the AttrArray
    #
    # @return [Set]
    def union
      self.reduce(&:union)
    end

    # Takes the intersection of all sets in the AttrArray
    #
    # @return [Set]
    def intersection
      self.reduce(&:intersection)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tree_clusters-0.8.3 lib/tree_clusters/attr_array.rb
tree_clusters-0.8.2 lib/tree_clusters/attr_array.rb
tree_clusters-0.8.1 lib/tree_clusters/attr_array.rb
tree_clusters-0.8.0 lib/tree_clusters/attr_array.rb
tree_clusters-0.7.0 lib/tree_clusters/attr_array.rb