Module: DataMapper::Model::Scope

Module | DataMapper::Model::Scope
In: | lib/dm-core/model/scope.rb

Module with query scoping functionality.

Scopes are implemented using simple array based stack that is thread local. Default scope can be set on a per repository basis.

Scopes are merged as new queries are nested. It is also possible to get exclusive scope access using `with_exclusive_scope`

### Methods

current_scope default_scope query with_exclusive_scope with_scope

### Public Instance methods

current_scope()

TODO: document @api private

default_scope(repository_name = default_repository_name)

TODO: document @api private

query()

Returns query on top of scope stack

@api private

### Protected Instance methods

with_exclusive_scope(query) {|query.freeze| ...}

Pushes given query on top of scope stack and yields given block, then pops the stack. During block execution queries previously pushed onto the stack have no effect.

@api private

with_scope(query) {|*block_args| ...}

Pushes given query on top of the stack

@param [Hash, Query] Query to add to current scope nesting

@api private

[Validate]