Sha256: 0141b00d1ac077d92da3501d78455af5e7ebf80408bcc1cdd91999e2d18e0836

Contents?: true

Size: 943 Bytes

Versions: 9

Compression:

Stored size: 943 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.indexing
    indexed.register  index.indexed
  end

  def [] name
    name = name.to_sym

    self.index_mapping[name]
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
picky-2.1.2 lib/picky/index_bundle.rb
picky-2.1.1 lib/picky/index_bundle.rb
picky-2.1.0 lib/picky/index_bundle.rb
picky-2.0.0 lib/picky/index_bundle.rb
picky-2.0.0.pre3 lib/picky/index_bundle.rb
picky-2.0.0.pre2 lib/picky/index_bundle.rb
picky-2.0.0.pre1 lib/picky/index_bundle.rb
picky-1.5.4 lib/picky/index_bundle.rb
picky-1.5.3 lib/picky/index_bundle.rb