Sha256: c848b4e3ea4ff5303a57f436e17f0317cbce2e90f0effe8af4f74e7a12004d8b
Contents?: true
Size: 773 Bytes
Versions: 4
Compression:
Stored size: 773 Bytes
Contents
module ROM module RA class Operation class Join include Charlatan.new(:left) include Enumerable attr_reader :right def initialize(left, right) super @left, @right = left, right end def header left.header + right.header end def each(&block) return to_enum unless block join_map = left.each_with_object({}) { |tuple, h| others = right.find_all { |t| (tuple.to_a & t.to_a).any? } (h[tuple] ||= []).concat(others) } tuples = left.map { |tuple| join_map[tuple].map { |other| tuple.merge(other) } }.flatten tuples.each(&block) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rom-0.4.2 | lib/rom/ra/operation/join.rb |
rom-0.4.1 | lib/rom/ra/operation/join.rb |
rom-0.4.0 | lib/rom/ra/operation/join.rb |
rom-0.3.1 | lib/rom/ra/operation/join.rb |