Sha256: 6171e40b72e2ea10d6c115aa9b9976fe16f142ab085f6e32f653476ed8b15813

Contents?: true

Size: 738 Bytes

Versions: 10

Compression:

Stored size: 738 Bytes

Contents

module ActiveFedora::Indexers
  ##
  # Applies indexing hints to any given property, independent of what that
  # property
  class GlobalIndexer
    # @param [Array<Symbol>] index_types The indexing hints to use.
    def initialize(index_types=nil)
      @index_types = Array.wrap(index_types)
    end


    # The global indexer acts as both an indexer factory and an indexer, since
    # the property doesn't matter.
    def new(property)
      self
    end

    # @param [ActiveFedora::Indexing::Map::IndexObject, #as] index_obj The indexing
    #   object to call #as on.
    def index(index_obj)
      unless index_types.empty?
        index_obj.as(*index_types)
      end
    end

    private

    attr_reader :index_types
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active-fedora-9.5.0 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.4.3 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.4.2 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.4.1 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.4.0 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.3.0 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.2.1 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.2.0 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.2.0.rc2 lib/active_fedora/indexers/global_indexer.rb
active-fedora-9.2.0.rc1 lib/active_fedora/indexers/global_indexer.rb