module Praxis::Mapper

An identity map that tracks data that's been loaded, and data that we still need to load. As tables are loaded and processed, the identity map will keep a list of child models that have been “seen” and will need to be loaded for the final view. The identity map defines a scope for the associated queries. The scope can be thought of as a set of named filters.

This is an abstract class. Does not have any ORM logic, but instead relies on a data store repository.

A resource creates a data store and instantiates a list of models that it wishes to load, building up the overall set of data that it will need. Once that is complete, the data set is iterated and a resultant view is generated.

Hackish write support for Praxis::Mapper, needed for FactoryBot.create calls. TODO: get rid of this and use current FactoryBot features to do it the right way.

In-memory query designed for use with the MemoryRepository for specs

Unoptimized, highly inefficient in-memory datastore designed for use with specs.

Constants

VERSION

Public Class Methods

finalize!() click to toggle source

Perform any final initialiation needed

# File lib/praxis-mapper.rb, line 37
def self.finalize!
  Praxis::Mapper::Model.finalize!
  Praxis::Mapper::Resource.finalize!
end
logger() click to toggle source

Get the logger configured for Praxis::Mapper

@example Basic usage

Praxis::Mapper.logger.info 'Something interesting happened'

@return [Logger] The currently configured logger or a STDOUT logger

# File lib/praxis-mapper.rb, line 17
def self.logger
  @logger ||= begin
    require 'logger'
    Logger.new(STDOUT)
  end
end
logger=(logger) click to toggle source

Set the logger configured for Praxis::Mapper

@example Basic usage

Praxis::Mapper.logger = Logger.new('log/development.log')

@return [Logger] The logger object

# File lib/praxis-mapper.rb, line 31
def self.logger=(logger)
  @logger = logger
end