Sha256: 5ffb7c09680eb11309f0927578d7c217d20e574921c5a66f13f7e553ed8a2168
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
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 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.2 | lib/veritas/algebra/intersection.rb |
veritas-0.0.1 | lib/veritas/algebra/intersection.rb |