Sha256: d55b5eae2280e25be1d16ffd8f85e2d0a0af80399617c204b290655b016c4699
Contents?: true
Size: 1.2 KB
Versions: 4
Compression:
Stored size: 1.2 KB
Contents
# encoding: utf-8 module Veritas module Algebra # The union between relations class Union < Relation include Relation::Operation::Set # Iterate over each tuple in the set # # @example # union = Union.new(left, right) # union.each { |tuple| ... } # # @yield [tuple] # # @yieldparam [Tuple] tuple # each tuple in the set # # @return [self] # # @api public def each return to_enum unless block_given? seen = {} left.each { |tuple| yield seen[tuple] = tuple } right.each { |tuple| yield tuple unless seen.key?(tuple) } self end module Methods extend Aliasable inheritable_alias(:| => :union) # Return the union between relations # # @example # union = relation.union(other) # # @param [Relation] other # # @return [Union] # # @api public def union(other) Union.new(self, other) end end # module Methods Relation.class_eval { include Methods } end # class Union end # module Algebra end # module Veritas
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.7 | lib/veritas/algebra/union.rb |
veritas-0.0.6 | lib/veritas/algebra/union.rb |
veritas-0.0.5 | lib/veritas/algebra/union.rb |
veritas-0.0.4 | lib/veritas/algebra/union.rb |