Sha256: f34b9167c7a0c071fc51abbd69474319e7301a5ddcbef2ddb1d81b9739a1dc2f
Contents?: true
Size: 638 Bytes
Versions: 9
Compression:
Stored size: 638 Bytes
Contents
# frozen_string_literal: true module Pursuit module DSL def self.included(base) base.extend ClassMethods end module ClassMethods def searchable(&block) if respond_to?(:search_options) || respond_to?(:search) raise "#{self} already has #search and #search_options defined." end options = SearchOptions.new(self, &block) define_singleton_method(:search_options) do options end define_singleton_method(:search) do |query| search = Pursuit::Search.new(options) search.perform(query) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems