Class: Valkyrie::Persistence::Solr::ModelConverter::EnumerableValue

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

Overview

Casts enumerable values one by one.

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

Determines whether or not a Property value is an Array

Parameters:

  • value (Object)

Returns:

  • (Boolean)


256
257
258
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 256

def self.handles?(value)
  value.is_a?(Property) && value.value.is_a?(Array)
end

Instance Method Details

#resultCompositeSolrRow

Constructs a CompositeSolrRow object for a set of Property values

Returns:



262
263
264
265
266
267
268
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 262

def result
  CompositeSolrRow.new(
    value.value.map do |val|
      calling_mapper.for(Property.new(value.key, val, value.value)).result
    end
  )
end