Sha256: 755d7e221d64ae6d059f02443986f5db821fe3f534306b0a64f0d27c05b1a53f

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require 'confstruct'

module BentoSearch
  class Error < ::StandardError ; end
end 

require "bento_search/engine"
require 'bento_search/routes'

require 'bento_search/util'

# ugh, sorry:
require File.dirname(__FILE__) + '/../app/models/bento_search/registrar'

# Crazy workaround to the fact that some versions of Hashie::Mash,
# when used with SafeAssignment as Confstruct does, don't let
# you use :id as a key. 
# https://github.com/intridea/hashie/issues/290
# We fix by removing the unused method with vary hacky meta programming
# sorry. 
require 'hashie/mash'
if Hashie::Mash.instance_methods(false).include?(:id)
  Hashie::Mash.send(:remove_method, :id)
end


module BentoSearch      
  def self.global_registrar
    @@global_registrar ||= BentoSearch::Registrar.new
  end
       
  # See BentoSearch::Registrar#register_engine, this is a
  # default global registrar. 
  def self.register_engine(id, data = nil, &block)
    global_registrar.register_engine(id, data, &block)    
  end
  
  def self.get_engine(id)
    global_registrar.get_engine(id)
  end
      
  # Mostly just used for testing
  def self.reset_engine_registrations!
    global_registrar.reset_engine_registrations!
  end

end


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bento_search-1.5.0 lib/bento_search.rb
bento_search-1.4.4 lib/bento_search.rb
bento_search-1.4.3 lib/bento_search.rb
bento_search-1.4.2 lib/bento_search.rb