Class: ROM::Memory::Schema

Inherits:
Schema
  • Object
show all
Defined in:
lib/rom/memory/schema.rb

Overview

Specialized schema for memory adapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from ROM::Schema

Instance Attribute Details

#__memoized__Object (readonly) Originally defined in module ROM::Memoizable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Instance Method Details

#call(relation) ⇒ Object

See Also:


14
15
16
# File 'lib/rom/memory/schema.rb', line 14

def call(relation)
  relation.new(relation.dataset.project(*map(&:name)), schema: self)
end

#finalize_associations!(relations:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal hook used during setup process


23
24
25
26
27
28
29
# File 'lib/rom/memory/schema.rb', line 23

def finalize_associations!(relations:)
  super do
    associations.map do |definition|
      Memory::Associations.const_get(definition.type).new(definition, relations)
    end
  end
end