Sha256: 7589bb635f412e8fca675b0a7f0fd3860372cfa079c423ecddbacae0ff515fd9

Contents?: true

Size: 712 Bytes

Versions: 10

Compression:

Stored size: 712 Bytes

Contents

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

10 entries across 10 versions & 1 rubygems

Version Path
rom-core-4.2.1 lib/rom/memory/schema.rb
rom-core-4.2.0 lib/rom/memory/schema.rb
rom-core-4.1.2 lib/rom/memory/schema.rb
rom-core-4.1.1 lib/rom/memory/schema.rb
rom-core-4.1.0 lib/rom/memory/schema.rb
rom-core-4.0.2 lib/rom/memory/schema.rb
rom-core-4.0.1 lib/rom/memory/schema.rb
rom-core-4.0.0 lib/rom/memory/schema.rb
rom-core-4.0.0.rc2 lib/rom/memory/schema.rb
rom-core-4.0.0.rc1 lib/rom/memory/schema.rb