Sha256: b39b741abc8c0d821159b103100f08ced7c8be3e3b1eb3af0b2523c2d986d26c

Contents?: true

Size: 844 Bytes

Versions: 13

Compression:

Stored size: 844 Bytes

Contents

# Comfortable API convenience class, splits methods to indexes.
#
class IndexesAPI # :nodoc:all
  
  attr_reader :indexes, :index_mapping
  
  delegate :reload,
           :load_from_cache,
           :to => :@indexed
  
  delegate :check_caches,
           :find,
           :generate_cache_only,
           :generate_index_only,
           :index,
           :index_for_tests,
           :to => :@indexing
  
  def initialize
    @indexes = []
    @index_mapping = {}
    
    @indexed  = Indexed::Indexes.new
    @indexing = Indexing::Indexes.new
  end
  
  def register index
    self.indexes << index
    self.index_mapping[index.name] = index
    
    @indexing.register index.indexing
    @indexed.register  index.indexed # TODO Even necessary?
  end
  
  def [] name
    name = name.to_sym
    
    self.index_mapping[name]
  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
picky-1.2.3 lib/picky/indexes_api.rb
picky-1.2.2 lib/picky/indexes_api.rb
picky-1.2.1 lib/picky/indexes_api.rb
picky-1.2.0 lib/picky/indexes_api.rb
picky-1.1.7 lib/picky/indexes_api.rb
picky-1.1.6 lib/picky/indexes_api.rb
picky-1.1.5 lib/picky/indexes_api.rb
picky-1.1.4 lib/picky/indexes_api.rb
picky-1.1.3 lib/picky/indexes_api.rb
picky-1.1.2 lib/picky/indexes_api.rb
picky-1.1.1 lib/picky/indexes_api.rb
picky-1.1.0 lib/picky/indexes_api.rb
picky-1.0.0 lib/picky/indexes_api.rb