Sha256: 6904e46c36d09ee010a5aaa5662693a0b9f4b744d983c152241636bff25962a3

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

module Internals

  # encoding: utf-8
  #
  module Indexed # :nodoc:all
  
    #
    #
    module Bundle
    
      # This is the _actual_ index (based on memory).
      #
      # Handles exact/partial index, weights index, and similarity index.
      #
      # Delegates file handling and checking to an *Indexed*::*Files* object.
      #
      class Memory < Base
      
        attr_accessor :index, :weights, :similarity, :configuration
      
        delegate :[], :to => :configuration
      
        def initialize name, configuration, *args
          super name, configuration, *args
        
          @configuration = {} # A hash with config options.
        
          @backend = Internals::Index::Files.new name, configuration
        end
      
        # Get the ids for the given symbol.
        #
        def ids sym
          @index[sym] || []
        end
        # Get a weight for the given symbol.
        #
        def weight sym
          @weights[sym]
        end
      
        # Loads the core index.
        #
        def load_index
          self.index = @backend.load_index
        end
        # Loads the weights index.
        #
        def load_weights
          self.weights = @backend.load_weights
        end
        # Loads the similarity index.
        #
        def load_similarity
          self.similarity = @backend.load_similarity
        end
        # Loads the configuration.
        #
        def load_configuration
          self.configuration = @backend.load_configuration
        end
      
      end
    
    end
  
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
picky-1.5.2 lib/picky/internals/indexed/bundle/memory.rb
picky-1.5.1 lib/picky/internals/indexed/bundle/memory.rb
picky-1.5.0 lib/picky/internals/indexed/bundle/memory.rb
picky-1.4.3 lib/picky/internals/indexed/bundle/memory.rb
picky-1.4.2 lib/picky/internals/indexed/bundle/memory.rb