Sha256: 381202b1115f0d8f714cf0b482622be617d0cddde3091533814b328f418d86d4

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

module Scrivito
module Backend

# Abstract Base for Index Implementations
module Index

  IMPLEMENTATIONS = [
    Backend::PathIndex,
    Backend::ParentPathIndex,
    Backend::PermalinkIndex,
  ].freeze

  IMPLEMENTATION_BY_NAME = IMPLEMENTATIONS.inject({}) do |result, index|
    result.merge(index.id => index)
  end

  def self.by_name(name)
    IMPLEMENTATION_BY_NAME[name.to_s] or
      raise Scrivito::InternalError, "unknown index #{name}"
  end

  def id
    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

5 entries across 5 versions & 1 rubygems

Version Path
scrivito_sdk-0.65.2 lib/scrivito/backend/index.rb
scrivito_sdk-0.65.1 lib/scrivito/backend/index.rb
scrivito_sdk-0.65.0 lib/scrivito/backend/index.rb
scrivito_sdk-0.65.0.rc2 lib/scrivito/backend/index.rb
scrivito_sdk-0.65.0.rc1 lib/scrivito/backend/index.rb