Sha256: da5a6877e64564ef01c236c99e946f0d4c0b9e36904eff42ba2e4e82706e8508
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
# encoding: utf-8 module Veritas module Algebra # The intersection between relations class Intersection < Relation include Relation::Operation::Set # Iterate over each tuple in the set # # @example # intersection = Intersection.new(left, right) # intersection.each { |tuple| ... } # # @yield [tuple] # # @yieldparam [Tuple] tuple # each tuple in the set # # @return [self] # # @api public def each return to_enum unless block_given? right_set = right.to_set left.each { |tuple| yield tuple if right_set.include?(tuple) } self end module Methods extend Aliasable inheritable_alias(:& => :intersect) # Return the intersection between relations # # @example # intersection = relation.intersect(other) # # @param [Relation] other # # @return [Intersection] # # @api public def intersect(other) Intersection.new(self, other) end end # module Methods Relation.class_eval { include Methods } end # class Intersection end # module Algebra end # module Veritas
Version data entries
4 entries across 4 versions & 1 rubygems