vendor/plugins/searchgasm-1.0.2/lib/searchgasm/search/base.rb
# Creates virtual classes for the class passed to it. This is a neccesity for keeping dynamically created method
# names specific to models. It provides caching and helps a lot with performance.
Creates virtual classes for the class passed to it. This is a neccesity for keeping dynamically created method
names specific to models. It provides caching and helps a lot with performance.
Creates virtual classes for the class passed to it . This is a neccesity for keeping dynamically created method names specific to models . It provides caching and helps a lot with performance .
def create_virtual_class(model_class)
          class_search_name = "::Searchgasm::Cache::#{model_class.name}Search"
          begin
            eval(class_search_name)
          rescue NameError
            eval <<-end_eval
              class #{class_search_name} < ::Searchgasm::Search::Base
                def self.klass
                  #{model_class.name}
                end
                def klass
                  #{model_class.name}
                end
              end
              #{class_search_name}
            end_eval
          end
        end
def create_virtual_class ( model_class ) class_search_name = "::Searchgasm::Cache::#{model_class.name}Search" begin eval ( class_search_name ) rescue NameError eval <<-end_eval 
              class  #{ class_search_name }  < ::Searchgasm::Search::Base
                def self.klass
                   #{ model_class . name } 
                end
                
                def klass
                   #{ model_class . name } 
                end
              end
              
               #{ class_search_name } end_eval end end
Creates virtual classes for the class passed to it.
Creates virtual classes for the class passed to it .
# The method definitions are for performance, bottlenecks found with ruby-prof
model_class