Sha256: 39e150490e1e4ddd4f1e04f7e0488e9171dd6e8590615fa3eb5f9ca01f342411

Contents?: true

Size: 816 Bytes

Versions: 2

Compression:

Stored size: 816 Bytes

Contents

begin
  # require 'time'
  # require 'date'
  require 'rsolr'
rescue LoadError
  require 'rubygems'
  require 'rsolr'
end

%w(collection index_builder session active_record).each do |file|
  require File.join(File.dirname(__FILE__), 'flare', file)
end

ActiveRecord::Base.send(:include, Flare::ActiveRecord)

module Flare
  class << self

    attr_reader :solr_url
    
    def solr=(value)
      @session = Flare::Session.new(value)
    end
    
    def session
      return @session if @session
      self.solr = "http://127.0.0.1:8983/solr"
      @session
    end
    
    def indexed_models
      @@indexed_models ||= []
    end
    
    def log(message)
      if Object.const_defined?("ActiveRecord")
        ::ActiveRecord::Base.logger.debug(message)
      else
        puts message
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flare-1.7.0 lib/flare.rb
flare-1.6.1 lib/flare.rb