module Scrivito module Backend 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 end end end