Class: ROM::Memory::Schema

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

Overview

Specialized schema for memory adapter

Constant Summary

Constants inherited from Schema

Schema::DEFAULT_INFERRER, Schema::EMPTY_ASSOCIATION_SET

Constants included from ROM::Memoizable

ROM::Memoizable::MEMOIZED_HASH

Instance Attribute Summary

Attributes inherited from Schema

#associations, #attributes, #canonical, #inferrer, #name, #primary_key_name, #primary_key_names

Attributes included from ROM::Memoizable

#__memoized__

Instance Method Summary collapse

Methods inherited from Schema

#[], #append, attributes, #canonical?, define, #each, #empty?, #exclude, #finalize!, #finalize_attributes!, #foreign_key, #initialize, #key?, #merge, #prefix, #primary_key, #project, #rename, #set!, #to_ary, #to_ast, #to_h, #to_input_hash, #to_output_hash, #uniq, #wrap

Methods included from Notifications::Listener

#subscribe

Methods included from Initializer

extended

Methods included from ROM::Memoizable

included

Constructor Details

This class inherits a constructor from ROM::Schema

Instance Method Details

#call(relation) ⇒ Object

See Also:



12
13
14
# File 'lib/rom/memory/schema.rb', line 12

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



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

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