Sha256: 89ecbcb38ccef8080721e0c993f595951c8df6111b1e348ba67f82f9c6f47b9f

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require "active_record"
require "chartkick"
require "groupdate"

require "searchjoy/track"
require "searchjoy/engine" if defined?(Rails)
require "searchjoy/version"

module Searchjoy
  # time zone
  mattr_reader :time_zone
  def self.time_zone=(time_zone)
    @@time_zone = time_zone.is_a?(String) ? ActiveSupport::TimeZone.new(time_zone) : time_zone
  end

  # top searches
  mattr_accessor :top_searches
  self.top_searches = 100

  # conversion name
  mattr_accessor :conversion_name
end

begin
  require "searchkick"
rescue LoadError
  # do nothing
end

if defined?(Searchkick)
  module Searchkick
    module Reindex
      def self.extended(base)
        base.send(:extend, Searchjoy::Track)
        method_name = Searchkick.respond_to?(:search_method_name) ? Searchkick.search_method_name : :search
        base.define_singleton_method(:search_without_track, base.method(method_name))
        base.define_singleton_method(method_name, base.method(:search_with_track))
      end
    end

    class Results
      attr_accessor :search
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
searchjoy-0.0.10 lib/searchjoy.rb