Class: Valkyrie::Persistence::Postgres::ResourceFactory

Inherits:
Object
  • Object
show all
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

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_classObject

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