Class: Valkyrie::Persistence::Postgres::ResourceFactory
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Postgres::ResourceFactory
- Defined in:
- lib/valkyrie/persistence/postgres/resource_factory.rb
Overview
Provides access to generic methods for converting to/from Resource and ORM::Resource.
Class Method Summary collapse
-
.from_resource(resource:) ⇒ Valkyrie::Persistence::Postgres::ORM::Resource
ActiveRecord resource for the Valkyrie resource.
-
.orm_class ⇒ Object
Accessor for the ActiveRecord class which all Postgres resources are an instance of.
-
.to_resource(object:) ⇒ Valkyrie::Resource
Model representation of the AR record.
Class Method Details
.from_resource(resource:) ⇒ Valkyrie::Persistence::Postgres::ORM::Resource
19 20 21 |
# File 'lib/valkyrie/persistence/postgres/resource_factory.rb', line 19 def from_resource(resource:) ::Valkyrie::Persistence::Postgres::ResourceConverter.new(resource, resource_factory: self).convert! end |
.orm_class ⇒ Object
Accessor for the ActiveRecord class which all Postgres resources are an instance of.
25 26 27 |
# File 'lib/valkyrie/persistence/postgres/resource_factory.rb', line 25 def orm_class ::Valkyrie::Persistence::Postgres::ORM::Resource end |
.to_resource(object:) ⇒ Valkyrie::Resource
12 13 14 |
# File 'lib/valkyrie/persistence/postgres/resource_factory.rb', line 12 def to_resource(object:) ::Valkyrie::Persistence::Postgres::ORMConverter.new(object).convert! end |