Sha256: 1f80e3ade561af49101303804a7fe3d0bf6a01c64cd4a204bfafd782704b47e2

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'confstruct'

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

1 entries across 1 versions & 1 rubygems

Version Path
bento_search-1.3.0 lib/bento_search.rb