Class: Valkyrie::Persistence::Solr::ResourceFactory
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Solr::ResourceFactory
- Defined in:
- lib/valkyrie/persistence/solr/resource_factory.rb
Overview
Provides access to generic methods for converting to/from Resource and hashes for persistence into Solr.
Instance Attribute Summary collapse
-
#resource_indexer ⇒ Object
readonly
Returns the value of attribute resource_indexer.
Instance Method Summary collapse
-
#from_resource(resource:) ⇒ Hash
The solr document represented as a hash.
-
#initialize(resource_indexer:) ⇒ ResourceFactory
constructor
A new instance of ResourceFactory.
- #to_resource(object:) ⇒ Valkyrie::Resource
Constructor Details
#initialize(resource_indexer:) ⇒ ResourceFactory
Returns a new instance of ResourceFactory.
9 10 11 |
# File 'lib/valkyrie/persistence/solr/resource_factory.rb', line 9 def initialize(resource_indexer:) @resource_indexer = resource_indexer end |
Instance Attribute Details
#resource_indexer ⇒ Object (readonly)
Returns the value of attribute resource_indexer.
8 9 10 |
# File 'lib/valkyrie/persistence/solr/resource_factory.rb', line 8 def resource_indexer @resource_indexer end |
Instance Method Details
#from_resource(resource:) ⇒ Hash
Returns The solr document represented as a hash.
22 23 24 |
# File 'lib/valkyrie/persistence/solr/resource_factory.rb', line 22 def from_resource(resource:) Valkyrie::Persistence::Solr::ModelConverter.new(resource, resource_factory: self).convert! end |
#to_resource(object:) ⇒ Valkyrie::Resource
16 17 18 |
# File 'lib/valkyrie/persistence/solr/resource_factory.rb', line 16 def to_resource(object:) ORMConverter.new(object).convert! end |