Sha256: 49114265958cab0bff491dc53d75c9329b02d7b274752ce7481337bb987684f9
Contents?: true
Size: 979 Bytes
Versions: 27
Compression:
Stored size: 979 Bytes
Contents
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt module Lhm # Determine and format columns common to origin and destination. class Intersection def initialize(origin, destination, renames = {}) @origin = origin @destination = destination @renames = renames end def origin (common + @renames.keys).extend(Joiners) end def destination (common + @renames.values).extend(Joiners) end private def common (@origin.columns.keys & @destination.columns.keys).sort end module Joiners def escaped map { |name| tick(name) } end def joined escaped.join(', ') end def typed(type) map { |name| qualified(name, type) }.join(', ') end private def qualified(name, type) "`#{ type }`.`#{ name }`" end def tick(name) "`#{ name }`" end end end end
Version data entries
27 entries across 27 versions & 2 rubygems