module Cequel::Record::Scoped::ClassMethods

Scoping-related methods for {Record} classes

Public Instance Methods

current_scope() click to toggle source

@private

# File lib/cequel/record/scoped.rb, line 25
def current_scope
  delegating_scope || RecordSet.new(self)
end
with_scope(record_set) { || ... } click to toggle source

@private

# File lib/cequel/record/scoped.rb, line 30
def with_scope(record_set)
  previous_scope = delegating_scope
  self.delegating_scope = record_set
  yield
ensure
  self.delegating_scope = previous_scope
end

Protected Instance Methods

delegating_scope() click to toggle source
# File lib/cequel/record/scoped.rb, line 40
def delegating_scope
  Thread.current[delegating_scope_key]
end
delegating_scope=(delegating_scope) click to toggle source
# File lib/cequel/record/scoped.rb, line 44
def delegating_scope=(delegating_scope)
  Thread.current[delegating_scope_key] = delegating_scope
end
delegating_scope_key() click to toggle source
# File lib/cequel/record/scoped.rb, line 48
def delegating_scope_key
  @delegating_scope_key ||= :"#{name}::delegating_scope"
end