Module: DataMapper::Scope

Protected Visibility

Protected Instance Method Summary

#with_exclusive_scope(query, &block)
#with_scope(query, &block)

Protected Instance Method Details

with_exclusive_scope

protected with_exclusive_scope(query, &block)
[View source]


10
11
12
13
14
15
16
17
18
19
20
# File 'dm-core/lib/dm-core/scope.rb', line 10

def with_exclusive_scope(query, &block)
  query = DataMapper::Query.new(repository, self, query) if Hash === query

  scope_stack << query

  begin
    yield
  ensure
    scope_stack.pop
  end
end

with_scope

protected with_scope(query, &block)
[View source]


5
6
7
8
# File 'dm-core/lib/dm-core/scope.rb', line 5

def with_scope(query, &block)
  # merge the current scope with the passed in query
  with_exclusive_scope(current_scope ? current_scope.merge(query) : query, &block)
end