module Flex::Result::DocumentLoader::ModelClasses

Public Instance Methods

map() click to toggle source

maps all the index/types to the ruby class

# File lib/flex/result/document_loader.rb, line 17
def map
  @map ||= begin
             map = {}
             (Conf.flex_models + Conf.flex_active_models).each do |m|
               m = eval("::#{m}") if m.is_a?(String)
               indices = m.flex.index.is_a?(Array) ? m.flex.index : [m.flex.index]
               types = m.flex.type.is_a?(Array) ? m.flex.type : [m.flex.type]
               indices.each do |i|
                 types.each { |t| map["#{i}/#{t}"] = m }
               end
             end
             map
           end
end