Class: Valkyrie::IndexingAdapter
- Inherits:
-
Object
- Object
- Valkyrie::IndexingAdapter
- Defined in:
- lib/valkyrie/indexing_adapter.rb
Overview
IndexingAdapter is the primary DataMapper object for indexing.
Used to register and locate adapters, for individual
indexing backends (such as solr, elasticsearch, etc)
Class Method Summary collapse
-
.find(short_name) ⇒ Object
Find an adapter by its short name.
-
.register(adapter, short_name) ⇒ Object
Register an adapter by a short name.
Class Method Details
.find(short_name) ⇒ Object
Find an adapter by its short name.
22 23 24 25 26 |
# File 'lib/valkyrie/indexing_adapter.rb', line 22 def find(short_name) symbolized_key = short_name.to_sym return adapters[symbolized_key] if adapters.key?(symbolized_key) raise KeyError, "Unable to find unregistered adapter `#{short_name}'" end |
.register(adapter, short_name) ⇒ Object
Register an adapter by a short name. Registering an adapter by a short name makes the adapter easier to find and reference.
14 15 16 |
# File 'lib/valkyrie/indexing_adapter.rb', line 14 def register(adapter, short_name) adapters[short_name.to_sym] = adapter end |