Sha256: 18551d49e4bb3fc82be0569c0f3091e0427331c372ed6a9298a2711f2b918826

Contents?: true

Size: 859 Bytes

Versions: 27

Compression:

Stored size: 859 Bytes

Contents

module Indexing
  
  class Categories
    
    attr_reader :categories
    
    each_delegate :index,
                  :cache,
                  :generate_caches,
                  :backup_caches,
                  :restore_caches,
                  :check_caches,
                  :clear_caches,
                  :create_directory_structure,
                  :to => :categories
    
    def initialize
      @categories = []
    end
    
    def << category
      categories << category
    end
    
    def find category_name
      category_name = category_name.to_sym
      
      categories.each do |category|
        next unless category.name == category_name
        return category
      end
      
      raise %Q{Index category "#{category_name}" not found. Possible categories: "#{categories.map(&:name).join('", "')}".}
    end
    
  end
  
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
picky-1.0.0 lib/picky/indexing/categories.rb
picky-0.12.3 lib/picky/indexing/categories.rb
picky-0.12.2 lib/picky/indexing/categories.rb
picky-0.12.1 lib/picky/indexing/categories.rb
picky-0.12.0 lib/picky/indexing/categories.rb
picky-0.11.2 lib/picky/indexing/categories.rb
picky-0.11.1 lib/picky/indexing/categories.rb