Class DataMapper::Sweatshop
In: lib/dm-sweatshop/sweatshop.rb
lib/dm-sweatshop/unique.rb
lib/dm-sweatshop/version.rb
Parent: Object

Methods

Classes and Modules

Module DataMapper::Sweatshop::Unique
Class DataMapper::Sweatshop::NoFixtureExist
Class DataMapper::Sweatshop::UniqueWorker

Constants

VERSION = '0.10.1'.freeze

Attributes

model_map  [RW] 
record_map  [RW] 

Public Class methods

Adds a Proc to model map. Proc must return a Hash of attributes.

@param klass [Class, DataMapper::Resource] @param name [Symbol] @param instance [DataMapper::Resource]

@api private

@returns [Array] model map

Returns a Hash of attributes from the model map

@param klass [Class, DataMapper::Resource] @param name [Symbol]

@returns [Hash] existing instance of a model from the model map @raises NoFixtureExist when requested fixture does not exist in the model map

@api private

Creates an instance from given hash of attributes, saves it and adds it to the record map.

@param klass [Class, DataMapper::Resource] @param name [Symbol] @param attributes [Hash]

@api private

@returns [DataMapper::Resource] added instance

Same as create but calls Model#create! and does save invalid models

@param klass [Class, DataMapper::Resource] @param name [Symbol] @param attributes [Hash]

@api private

@returns [DataMapper::Resource] added instance

Returns a Hash with callable values evaluated.

@param hash [Hash]

@returns [Hash] existing instance of a model from the model map

@api private

Creates an instance from given hash of attributes and adds it to records map without saving.

@param klass [Class, DataMapper::Resource] @param name [Symbol] @param attributes [Hash]

@api private

@returns [DataMapper::Resource] added instance

Returns a pre existing instance of a model from the record map

@param klass [Class, DataMapper::Resource] @param name [Symbol]

@returns [DataMapper::Resource] existing instance of a model from the record map @raises DataMapper::Sweatshop::NoFixtureExist when requested fixture does not exist in the record map

@api private

Adds an instance to records map.

@param klass [Class, DataMapper::Resource] @param name [Symbol] @param instance [DataMapper::Resource]

@api private

@returns [DataMapper::Resource] added instance

[Validate]