module Elastictastic::Scoped

Public Instance Methods

current_scope() click to toggle source
# File lib/elastictastic/scoped.rb, line 16
def current_scope
  scope_stack.last || default_scope
end
scope_stack() click to toggle source
# File lib/elastictastic/scoped.rb, line 12
def scope_stack
  Thread.current["#{name}::scope_stack"] ||= []
end
with_scope(scope) { || ... } click to toggle source
# File lib/elastictastic/scoped.rb, line 3
def with_scope(scope)
  scope_stack.push(scope)
  begin
    yield
  ensure
    scope_stack.pop
  end
end