Sha256: ec6da27f7a44e567420f11d1b6392b07a78982a214ffb98310f56194e9edb7ec
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Picky module Indexed # :nodoc:all class Bundle < Picky::Bundle # Removes the given id from the indexes. # def remove id # Is it anywhere? # syms = @realtime_mapping[id] return unless syms syms.each do |sym| ids = @inverted[sym] ids.delete id if ids.empty? @inverted.delete sym @weights.delete sym else @weights[sym] = self.weights_strategy.weight_for ids.size end end @realtime_mapping.delete id end # Returns a reference to the array where the id has been added. # def add id, sym ary = @inverted[sym] syms = @realtime_mapping[id] syms = (@realtime_mapping[id] = []) unless syms # TODO Nicefy. ids = if syms.include? sym ids = @inverted[sym] ids.delete id # Move id ids.unshift id # to front else syms << sym inverted = @inverted[sym] ||= [] inverted.unshift id end @weights[sym] = self.weights_strategy.weight_for ids.size end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
picky-3.1.10 | lib/picky/indexed/bundle_realtime.rb |