Sha256: a501fdc5f549653b535aa03cf1687047fea5471c573a48af2f062f30ca3ec5c7

Contents?: true

Size: 988 Bytes

Versions: 8

Compression:

Stored size: 988 Bytes

Contents

module Indexed
  
  #
  #
  class Index
    
    attr_reader :name, :result_identifier, :combinator, :categories
    
    delegate :load_from_cache,
             :to => :categories
    
    def initialize name, options = {}
      @name                     = name
      
      @result_identifier        = options[:result_identifier] || 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 Doc.
    #
    def define_category category_name, options = {}
      new_category = Category.new category_name, self, options
      categories << new_category
      new_category
    end
    
    # Return the possible combinations for this token.
    #
    # A combination is a tuple <token, index_bundle>.
    #
    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.4.1 lib/picky/indexed/index.rb
picky-1.4.0 lib/picky/indexed/index.rb
picky-1.3.4 lib/picky/indexed/index.rb
picky-1.3.3 lib/picky/indexed/index.rb
picky-1.3.2 lib/picky/indexed/index.rb
picky-1.3.1 lib/picky/indexed/index.rb
picky-1.3.0 lib/picky/indexed/index.rb
picky-1.2.4 lib/picky/indexed/index.rb