Class DataMapper::Repository
In: lib/dm-core/repository.rb
Parent: Object

Methods

adapter   adapters   context   create   default_name   delete   identity_map   inspect   new   new_query   read   scope   update  

Included Modules

DataMapper::Assertions

External Aliases

name -> to_sym
  @api semipublic

Attributes

name  [R]  @api semipublic

Public Class methods

Get the list of adapters registered for all Repositories, keyed by repository name.

  TODO: create example

@return [Hash(Symbol => Adapters::AbstractAdapter)]

  the adapters registered for all Repositories

@api private

Get the stack of current repository contexts

  TODO: create example

@return [Array]

  List of Repository contexts for the current Thread

@api private

Get the default name of this Repository

  TODO: create example

@return [Symbol]

  the default name of this repository

@api private

Initializes a new Repository

  TODO: create example

@param [Symbol] name

  The name of the Repository

@api semipublic

Public Instance methods

Get the adapter for this repository

Lazy loads adapter setup from registered adapters

  TODO: create example

@return [Adapters::AbstractAdapter]

  the adapter for this repository

@raise [RepositoryNotSetupError]

  if there is no adapter registered for a repository named @name

@api semipublic

Create one or more resource instances in this repository.

  TODO: create example

@param [Enumerable(Resource)] resources

  The list of resources (model instances) to create

@return [Integer]

  The number of records that were actually saved into the data-store

@api semipublic

Delete one or more resource instances

  TODO: create example

@param [Collection] collection

  collection of records to be deleted

@return [Integer]

  the number of records deleted

@api semipublic

Get the identity for a particular model within this repository.

If one doesn‘t yet exist, create a new default in-memory IdentityMap for the requested model.

  TODO: create example

@param [Model] model

  Model whose identity map should be returned

@return [IdentityMap]

  The IdentityMap for model in this Repository

@api private

Return a human readable representation of the repository

  TODO: create example

@return [String]

  human readable representation of the repository

@api private

Create a Query or subclass instance for this repository.

@param [Model] model

  the Model to retrieve results from

@param [Hash] options

  the conditions and scope

@return [Query]

@api semipublic

Retrieve a collection of results of a query

  TODO: create example

@param [Query] query

  composition of the query to perform

@return [Array]

  result set of the query

@api semipublic

Executes a block in the scope of this Repository

  TODO: create example

@yieldparam [Repository] repository

  yields self within the block

@yield

  execute block in the scope of this Repository

@api private

Update the attributes of one or more resource instances

  TODO: create example

@param [Hash(Property => Object)] attributes

  hash of attribute values to set, keyed by Property

@param [Collection] collection

  collection of records to be updated

@return [Integer]

  the number of records updated

@api semipublic

[Validate]