Class: Valkyrie::Persistence::Solr::ModelConverter::IntegerPropertyValue

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

Overview

Casts Integer values into a recognizable string in Solr.

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 Integer

Parameters:

  • value (Object)

Returns:

  • (Boolean)


316
317
318
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 316

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

Instance Method Details

#resultSolrRow

Note:

this prepends the string “integer-” to the value indexed in Solr

Constructs a SolrRow object for the Property Integer value

Returns:



323
324
325
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 323

def result
  calling_mapper.for(Property.new(value.key, "integer-#{value.value}")).result
end