Class: Gearbox::Types::Float

Inherits:
Object
  • Object
show all
Includes:
Gearbox::Type
Defined in:
lib/gearbox/types/float.rb

Overview

A Gearbox::Type for Float values. Values will be associated with the ‘XSD.double` type.

A Resource property can reference this type as ‘Gearbox::Types::Float`, `Float`, `XSD.double`, or `XSD.float`.

Class Method Summary collapse

Methods included from Gearbox::Type

included

Class Method Details

.serialize(value) ⇒ Object



20
21
22
# File 'lib/gearbox/types/float.rb', line 20

def self.serialize(value)
  RDF::Literal.new(value.to_f, :datatype => XSD.double)
end

.unserialize(value) ⇒ Object



16
17
18
# File 'lib/gearbox/types/float.rb', line 16

def self.unserialize(value)
  value.object.to_f
end