Sha256: 174bf48796d9b627dbfafbfdb13a30d9b9a4dd7e76d18c5189657334cda996bc

Contents?: true

Size: 873 Bytes

Versions: 8

Compression:

Stored size: 873 Bytes

Contents

module Indexed
  
  #
  #
  class Index
    
    attr_reader :name, :result_type, :combinator, :categories
    
    delegate :load_from_cache,
             :to => :categories
    
    def initialize name, options = {}
      @name                     = name
      
      @result_type              = options[:result_type] || name
      ignore_unassigned_tokens  = options[:ignore_unassigned_tokens] || false # TODO Move to query, somehow.
      
      @categories = Categories.new ignore_unassigned_tokens: ignore_unassigned_tokens
    end
    
    # TODO Spec. Doc.
    #
    def define_category category_name, options = {}
      new_category = Category.new category_name, self, options
      categories << new_category
      new_category
    end
    
    #
    #
    def possible_combinations token
      categories.possible_combinations_for token
    end
    
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
picky-1.1.6 lib/picky/indexed/index.rb
picky-1.1.5 lib/picky/indexed/index.rb
picky-1.1.4 lib/picky/indexed/index.rb
picky-1.1.3 lib/picky/indexed/index.rb
picky-1.1.2 lib/picky/indexed/index.rb
picky-1.1.1 lib/picky/indexed/index.rb
picky-1.1.0 lib/picky/indexed/index.rb
picky-1.0.0 lib/picky/indexed/index.rb