Sha256: a1eb898e2fd31b2bfed3acab8948954a76e8e145f2bcf41f72f7f1d4f6c89ca4

Contents?: true

Size: 594 Bytes

Versions: 3

Compression:

Stored size: 594 Bytes

Contents

require 'rom/relation/wrap'

module ROM
  module SQL
    class Wrap < Relation::Wrap
      # @api public
      def schema
        root.schema.merge(nodes.map(&:schema).reduce(:merge)).qualified
      end

      # @api private
      def relation
        relation = nodes.reduce(root) do |a, e|
          if associations.key?(e.name.key)
            a.associations[e.name.key].join(:join, a, e)
          else
            # TODO: deprecate this before 2.0
            a.qualified.join(e.name.dataset, e.meta[:keys])
          end
        end
        schema.(relation)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-sql-2.0.0.beta3 lib/rom/sql/wrap.rb
rom-sql-2.0.0.beta2 lib/rom/sql/wrap.rb
rom-sql-2.0.0.beta1 lib/rom/sql/wrap.rb