Class: Valkyrie::Persistence::Solr::ORMConverter::IntegerValue
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Solr::ORMConverter::IntegerValue
- Defined in:
- lib/valkyrie/persistence/solr/orm_converter.rb
Overview
Converts an integer in solr into an Integer
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
-
.handles?(value) ⇒ Boolean
Determines whether or not a string representation of an Object is prefixed with “integer-”.
Instance Method Summary collapse
-
#result ⇒ Integer
Parses and casts the Solr field value into the integer value.
Methods inherited from ValueMapper
Constructor Details
This class inherits a constructor from Valkyrie::ValueMapper
Class Method Details
.handles?(value) ⇒ Boolean
Note:
this determines whether or not this should be mapped to an integer
Determines whether or not a string representation of an Object is prefixed with “integer-”
415 416 417 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 415 def self.handles?(value) value.to_s.start_with?("integer-") end |
Instance Method Details
#result ⇒ Integer
Parses and casts the Solr field value into the integer value
421 422 423 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 421 def result value.sub(/^integer-/, '').to_i end |