class Gearbox::Types::Decimal
A {Gearbox::Type} for integer values. Values will be associated with the ‘XSD.integer` type.
A {Gearbox::Resource} property can reference this type as ‘Gearbox::Types::Integer`, `Integer`, or `XSD.integer`.
Public Class Methods
serialize(value)
click to toggle source
# File lib/gearbox/types/decimal.rb, line 22 def self.serialize(value) RDF::Literal.new(value.is_a?(BigDecimal) ? value.to_s('F') : value.to_s, :datatype => XSD.decimal) end
unserialize(value)
click to toggle source
# File lib/gearbox/types/decimal.rb, line 17 def self.unserialize(value) object = value.object object.is_a?(BigDecimal) ? object : BigDecimal.new(object.to_s) end