Class: Valkyrie::Persistence::Solr::ORMConverter::NestedResourceValue

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

Overview

Converts a nested resource in solr into a Resource

Instance Attribute Summary

Attributes inherited from ValueMapper

#calling_mapper, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ValueMapper

for, #initialize, register

Constructor Details

This class inherits a constructor from Valkyrie::ValueMapper

Class Method Details

.handles?(value) ⇒ Boolean

Returns:

  • (Boolean)


158
159
160
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 158

def self.handles?(value)
  value.to_s.start_with?("serialized-")
end

Instance Method Details

#jsonObject



166
167
168
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 166

def json
  value.sub(/^serialized-/, '')
end

#resultObject



162
163
164
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 162

def result
  NestedResourceConverter.for(JSON.parse(json, symbolize_names: true)).result
end