Sha256: fcd0d6fa9d8b132c01f0965b8cc161a2990e40d5fd91a77ff8b3ac287fe6e858

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

module Scrivito
module Backend

# Abstract Base for Index Implementations
module BaseIndex
  def id
    abstract_base_method
  end

  def update(key, cached_result, change_index)
    updated = Set.new(cached_result)

    change_index.each do |id, data|
      value = extract_update_value_from_data(data)

      if value == key
        updated.add(id)
      else
        updated.delete(id)
      end
    end

    updated.to_a
  end

  def extract_update_value_from_data(data)
    abstract_base_method
  end

  def group_by(keys, obj_datas)
    return [obj_datas] if keys.length == 1

    group_by_multiple(keys, obj_datas)
  end

  def group_by_multiple(parent_paths, obj_datas)
    abstract_base_method
  end

  private

  def abstract_base_method
    raise Scrivito::InternalError, "not implemented"
  end

end

end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrivito_sdk-1.18.0 app/cms/scrivito/backend/base_index.rb
scrivito_sdk-1.18.0.rc1 app/cms/scrivito/backend/base_index.rb