Class: Valkyrie::Persistence::Fedora::Persister::OrmConverter::GraphToAttributes::FloatValue

Inherits:
ValueMapper
  • Object
show all
Defined in:
lib/valkyrie/persistence/fedora/persister/orm_converter.rb

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

Returns:

  • (Boolean)


353
354
355
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 353

def self.handles?(value)
  value.statement.object.is_a?(RDF::Literal) && value.statement.object.language.blank? && value.statement.object.datatype == PermissiveSchema.valkyrie_float
end

Instance Method Details

#resultObject



357
358
359
360
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 357

def result
  value.statement.object = value.statement.object.value.to_f
  calling_mapper.for(Property.new(statement: value.statement, scope: value.scope, adapter: value.adapter)).result
end