class Redwood::Index
just to make the backtraces even more insane, here we engage in yet more ::method_missing metaprogramming so that ::init will magically make Index act like the correct Index class.
Public Class Methods
const_missing(x;)
click to toggle source
# File lib/sup/index.rb, line 237 def self.const_missing x; @obj.class.const_get(x) end
init(type=nil)
click to toggle source
# File lib/sup/index.rb, line 216 def self.init type=nil ## determine the index type from the many possible ways of setting it type = (type == "auto" ? nil : type) || ENV['SUP_INDEX'] || $config[:index] || (File.exist?(File.join(BASE_DIR, "xapian")) && "xapian") || ## PRIORITIZE THIS (File.exist?(File.join(BASE_DIR, "ferret")) && "ferret") || ## deprioritize this DEFAULT_NEW_INDEX_TYPE begin require "sup/#{type}_index" @klass = Redwood.const_get "#{type.capitalize}Index" @obj = @klass.init rescue LoadError, NameError => e raise "unknown index type #{type.inspect}: #{e.message}" end debug "using #{type} index" @obj end
instance()
click to toggle source
# File lib/sup/index.rb, line 235 def self.instance; @obj end
method_missing(m, *a, &b;)
click to toggle source
# File lib/sup/index.rb, line 236 def self.method_missing m, *a, &b; @obj.send(m, *a, &b) end