Class: Valkyrie::Persistence::Solr::ORMConverter::BooleanValue
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Solr::ORMConverter::BooleanValue
- Defined in:
- lib/valkyrie/persistence/solr/orm_converter.rb
Overview
Converts an boolean in solr into an Boolean
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 “boolean-”.
Instance Method Summary collapse
-
#result ⇒ Boolean
Parses the Solr field value for the substring “true” Should “true” be present, True is returned.
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 boolean value
Determines whether or not a string representation of an Object is prefixed with “boolean-”
394 395 396 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 394 def self.handles?(value) value.to_s.start_with?("boolean-") end |
Instance Method Details
#result ⇒ Boolean
Parses the Solr field value for the substring “true” Should “true” be present, True is returned
401 402 403 404 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 401 def result val = value.sub(/^boolean-/, '') val.casecmp("true").zero? end |