Sha256: d252b1197ab377edbd20d8f21b0f2d5937ad2f01a9694445f324bb88ec182e83

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

module Indexing
  
  class Index
    
    attr_reader :name, :source, :categories, :after_indexing
    
    # Delegators for indexing.
    #
    delegate :connect_backend,
             :to => :source
             
    delegate :index,
             :cache,
             :generate_caches,
             :backup_caches,
             :restore_caches,
             :check_caches,
             :clear_caches,
             :create_directory_structure,
             :to => :categories
    
    def initialize name, source, options = {}
      @name   = name
      @source = source
      
      @after_indexing = options[:after_indexing]
      
      @categories = Categories.new
    end
    
    # TODO Spec. Doc.
    #
    def add_category category_name, options = {}
      options = default_category_options.merge options
      
      new_category = Category.new category_name, self, options
      categories << new_category
      new_category
    end
    
    # By default, the category uses the index's source.
    #
    def default_category_options
      { :source => @source }
    end
    
    # Indexing.
    #
    def take_snapshot
      source.take_snapshot self
    end
    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
picky-0.12.3 lib/picky/indexing/index.rb
picky-0.12.2 lib/picky/indexing/index.rb
picky-0.12.1 lib/picky/indexing/index.rb
picky-0.12.0 lib/picky/indexing/index.rb