Class: Valkyrie::Sequel::ResourceFactory::ResourceConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/valkyrie/sequel/resource_factory/resource_converter.rb

Constant Summary collapse

PRIMARY_TERMS =
[
  :id,
  :created_at,
  :updated_at,
  :internal_resource
].freeze
DISALLOWED_TERMS =
[
  :new_record
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, resource_factory:) ⇒ ResourceConverter

Returns a new instance of ResourceConverter.



18
19
20
21
# File 'lib/valkyrie/sequel/resource_factory/resource_converter.rb', line 18

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

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



15
16
17
# File 'lib/valkyrie/sequel/resource_factory/resource_converter.rb', line 15

def resource
  @resource
end

#resource_factoryObject (readonly)

Returns the value of attribute resource_factory.



15
16
17
# File 'lib/valkyrie/sequel/resource_factory/resource_converter.rb', line 15

def resource_factory
  @resource_factory
end

Instance Method Details

#convert!Object



23
24
25
26
27
28
# File 'lib/valkyrie/sequel/resource_factory/resource_converter.rb', line 23

def convert!
  output = database_hash
  output[:id] = resource.id.to_s if resource.id
  process_lock_token(output)
  output
end