Sha256: 2ef8427a4bf75771f01be3d1368e53c6f0d53ec5a847a30cda9850c2ffcc5f48

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

module Calagator
  class Event < ActiveRecord::Base
    class SearchEngine
      cattr_accessor(:kind) { :sql }

      def self.search(*args)
        search_engine.search(*args)
      end

      def self.use(kind)
        self.kind = kind
        search_engine.configure if search_engine.respond_to?(:configure)
      end

      def self.score?
        search_engine.score?
      end

      private_class_method

      def self.search_engine
        kind == :sunspot ? ApacheSunspot : Sql
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calagator-1.1.0 app/models/calagator/event/search_engine.rb