Sha256: 484055703952d72bf4068cdcca22989937a10f55d9c64483fa123d482b9bdc91

Contents?: true

Size: 743 Bytes

Versions: 15

Compression:

Stored size: 743 Bytes

Contents

# frozen_string_literal: true

require 'rom/schema'
require 'rom/memory/associations'

module ROM
  module Memory
    # Specialized schema for memory adapter
    #
    # @api public
    class Schema < ROM::Schema
      # @see Schema#call
      # @api public
      def call(relation)
        relation.new(relation.dataset.project(*map(&:name)), schema: self)
      end

      # Internal hook used during setup process
      #
      # @see Schema#finalize_associations!
      #
      # @api private
      def finalize_associations!(relations:)
        super do
          associations.map do |definition|
            Memory::Associations.const_get(definition.type).new(definition, relations)
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rom-core-5.3.2 lib/rom/memory/schema.rb
rom-core-5.3.1 lib/rom/memory/schema.rb
rom-core-5.3.0 lib/rom/memory/schema.rb
rom-core-5.2.6 lib/rom/memory/schema.rb
rom-core-5.2.5 lib/rom/memory/schema.rb
rom-core-5.2.4 lib/rom/memory/schema.rb
rom-core-5.2.3 lib/rom/memory/schema.rb
rom-core-5.2.2 lib/rom/memory/schema.rb
rom-core-5.2.1 lib/rom/memory/schema.rb
rom-core-5.1.2 lib/rom/memory/schema.rb
rom-core-5.1.1 lib/rom/memory/schema.rb
rom-core-5.1.0 lib/rom/memory/schema.rb
rom-core-5.0.2 lib/rom/memory/schema.rb
rom-core-5.0.1 lib/rom/memory/schema.rb
rom-core-5.0.0 lib/rom/memory/schema.rb