module ThinkingSphinx::Scopes::ClassMethods

Public Instance Methods

default_sphinx_scope(scope_name = nil) click to toggle source
# File lib/thinking_sphinx/scopes.rb, line 7
def default_sphinx_scope(scope_name = nil)
  return @default_sphinx_scope unless scope_name

  @default_sphinx_scope = scope_name
end
sphinx_scope(name, &block) click to toggle source
# File lib/thinking_sphinx/scopes.rb, line 13
def sphinx_scope(name, &block)
  sphinx_scopes[name] = block
end
sphinx_scopes() click to toggle source
# File lib/thinking_sphinx/scopes.rb, line 17
def sphinx_scopes
  @sphinx_scopes ||= {}
end

Private Instance Methods

method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/thinking_sphinx/scopes.rb, line 23
def method_missing(method, *args, &block)
  return super unless sphinx_scopes.keys.include?(method)

  query, options = sphinx_scopes[method].call(*args)
  search query, (options || {})
end
respond_to_missing?(method, include_private = false) click to toggle source
Calls superclass method
# File lib/thinking_sphinx/scopes.rb, line 30
def respond_to_missing?(method, include_private = false)
  super || sphinx_scopes.keys.include?(method)
end