Class: Valkyrie::Persistence::Postgres::ORMConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/valkyrie/persistence/postgres/orm_converter.rb

Overview

Responsible for converting a Valkyrie::Persistence::Postgres::ORM::Resource to a Resource

Defined Under Namespace

Classes: RDFMetadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orm_object, resource_factory:) ⇒ ORMConverter

Returns a new instance of ORMConverter.

Parameters:


10
11
12
13
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 10

def initialize(orm_object, resource_factory:)
  @orm_object = orm_object
  @resource_factory = resource_factory
end

Instance Attribute Details

#orm_objectObject (readonly)

Returns the value of attribute orm_object


6
7
8
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 6

def orm_object
  @orm_object
end

#resource_factoryObject (readonly)

Returns the value of attribute resource_factory


6
7
8
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 6

def resource_factory
  @resource_factory
end

Instance Method Details

#convert!Valkyrie::Resource

Create a new instance of the class described in attributes and send it all the attributes that @orm_object has

Returns:


18
19
20
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 18

def convert!
  @resource ||= resource
end