Sha256: 6839f30eb71a8b75dda3266778988c41af6fde14a404c3d6f5abb66a9630c71b

Contents?: true

Size: 1.16 KB

Versions: 21

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 define_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

21 entries across 21 versions & 1 rubygems

Version Path
picky-1.4.1 lib/picky/indexing/index.rb
picky-1.4.0 lib/picky/indexing/index.rb
picky-1.3.4 lib/picky/indexing/index.rb
picky-1.3.3 lib/picky/indexing/index.rb
picky-1.3.2 lib/picky/indexing/index.rb
picky-1.3.1 lib/picky/indexing/index.rb
picky-1.3.0 lib/picky/indexing/index.rb
picky-1.2.4 lib/picky/indexing/index.rb
picky-1.2.3 lib/picky/indexing/index.rb
picky-1.2.2 lib/picky/indexing/index.rb
picky-1.2.1 lib/picky/indexing/index.rb
picky-1.2.0 lib/picky/indexing/index.rb
picky-1.1.7 lib/picky/indexing/index.rb
picky-1.1.6 lib/picky/indexing/index.rb
picky-1.1.5 lib/picky/indexing/index.rb
picky-1.1.4 lib/picky/indexing/index.rb
picky-1.1.3 lib/picky/indexing/index.rb
picky-1.1.2 lib/picky/indexing/index.rb
picky-1.1.1 lib/picky/indexing/index.rb
picky-1.1.0 lib/picky/indexing/index.rb