Sha256: 1e8190c93f667a77b8f8f6ab21e4d6f82eee11b0bcd0a99b82303df4b4450c6a

Contents?: true

Size: 961 Bytes

Versions: 8

Compression:

Stored size: 961 Bytes

Contents

# Comfortable API convenience class, splits methods to indexes.
#
class IndexBundle # :nodoc:all

  attr_reader :indexes, :index_mapping, :indexing, :indexed

  delegate :size,
           :each,
           :to => :indexes

  delegate :analyze,
           :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 to_s
    indexes.map &:to_stats
  end

  def register index
    self.indexes << index
    self.index_mapping[index.name] = index

    indexing.register index.internal_indexing
    indexed.register  index.internal_indexed
  end

  def [] name
    name = name.to_sym

    self.index_mapping[name]
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
picky-2.5.0 lib/picky/index_bundle.rb
picky-2.4.3 lib/picky/index_bundle.rb
picky-2.4.2 lib/picky/index_bundle.rb
picky-2.4.1 lib/picky/index_bundle.rb
picky-2.4.0 lib/picky/index_bundle.rb
picky-2.3.0 lib/picky/index_bundle.rb
picky-2.2.1 lib/picky/index_bundle.rb
picky-2.2.0 lib/picky/index_bundle.rb