Sha256: 086898173db057508d9fbf6ac07889083d0fca7e7b4caf5679bd1da3681031da
Contents?: true
Size: 758 Bytes
Versions: 15
Compression:
Stored size: 758 Bytes
Contents
# frozen_string_literal: true module ThinkingSphinx::Scopes extend ActiveSupport::Concern module ClassMethods def default_sphinx_scope(scope_name = nil) return @default_sphinx_scope unless scope_name @default_sphinx_scope = scope_name end def sphinx_scope(name, &block) sphinx_scopes[name] = block end def sphinx_scopes @sphinx_scopes ||= {} end private 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 def respond_to_missing?(method, include_private = false) super || sphinx_scopes.keys.include?(method) end end end
Version data entries
15 entries across 15 versions & 1 rubygems