Sha256: 9a48ef188ca0c6412fe6e5bb6ba4f99c3d9e4093b6c5d43c7b515a9c6ea89bc3

Contents?: true

Size: 957 Bytes

Versions: 9

Compression:

Stored size: 957 Bytes

Contents

module Internals

  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 to_s
        categories.indented_to_s
      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

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
picky-2.1.2 lib/picky/internals/indexing/categories.rb
picky-2.1.1 lib/picky/internals/indexing/categories.rb
picky-2.1.0 lib/picky/internals/indexing/categories.rb
picky-2.0.0 lib/picky/internals/indexing/categories.rb
picky-2.0.0.pre3 lib/picky/internals/indexing/categories.rb
picky-2.0.0.pre2 lib/picky/internals/indexing/categories.rb
picky-2.0.0.pre1 lib/picky/internals/indexing/categories.rb
picky-1.5.4 lib/picky/internals/indexing/categories.rb
picky-1.5.3 lib/picky/internals/indexing/categories.rb