Sha256: 50f18e26a7d6bebb7ac9609cf22f433dbd2d1e239b9cce695147e9b04c0fd947

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

module Spira::Types

  ##
  # A {Spira::Type} for Double values.  Values will be associated with the
  # `XSD.double` type.
  #
  # A {Spira::Resource} property can reference this type as
  # `Spira::Types::Double`, `Double`, or `XSD.double`.
  #
  # @see Spira::Type
  # @see http://rdf.rubyforge.org/RDF/Literal.html
  class Double

    include Spira::Type

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

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

    register_alias RDF::XSD.double

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spira-3.1.0 lib/spira/types/double.rb
spira-3.0.0 lib/spira/types/double.rb
spira-2.1.0 lib/spira/types/double.rb