Class: Valkyrie::Persistence::Solr::ORMConverter::IDValue
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Solr::ORMConverter::IDValue
- Defined in:
- lib/valkyrie/persistence/solr/orm_converter.rb
Overview
Converts a stored ID value in solr into a ID
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 “id-”.
Instance Method Summary collapse
-
#result ⇒ Valkyrie::ID
Constructs a new Valkyrie::ID object using the ID parsed from the Solr field.
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 a Valkyrie ID
Determines whether or not a string representation of an Object is prefixed with “id-”
229 230 231 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 229 def self.handles?(value) value.to_s.start_with?("id-") end |
Instance Method Details
#result ⇒ Valkyrie::ID
Constructs a new Valkyrie::ID object using the ID parsed from the Solr field
235 236 237 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 235 def result Valkyrie::ID.new(value.sub(/^id-/, '')) end |