Sha256: f929bd06cc033b3b9a1cfb8bf3693a5901a526859cea5d63b40e3b7ca00de7b9

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

# This class defines the indexing and index API.
#
# Note: A Type holds both an Index::Type and an Indexing::Type.
#
class Type
  
  # TODO Delegation.
  #
  
  attr_reader :name, :indexing, :index
  
  def initialize name, source, options = {}
    @name     = name
    @indexing = Indexing::Type.new name, source, options
    @index    = Index::Type.new    name, options
    
    # Centralized registry.
    #
    ::Indexes.register self
  end
  
  # API.
  #
  # TODO Spec! Doc!
  #
  def category name, options = {}
    name = name.to_sym
    
    indexing.add_category name, options
    index.add_category    name, options
    
    self
  end
  # def location name, options = {}
  #   grid      = options.delete :grid
  #   precision = options.delete :precision
  #   
  #   options[:index_tokenizer] ||= Tokenizers::Index.new # TODO Or a specific location tokenizer.
  #   options[:query_tokenizer] ||= Tokenizers::Query.new # TODO Or a specific location tokenizer.
  #   options[:source_wrapper]  ||= Sources::Wrappers::Location.new(options)
  #   
  #   new_category = category name, options
  #   :source => Sources::Wrappers::Location.new(source, grid:2), :tokenizer => Tokenizers::Index.new
  # end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picky-0.11.2 lib/picky/type.rb
picky-0.11.1 lib/picky/type.rb
picky-0.11.0 lib/picky/type.rb