Sha256: 4c6c131364a9d2127d49f13e37744307ebe08964b772f6b70e0c1716d41bc28d

Contents?: true

Size: 618 Bytes

Versions: 7

Compression:

Stored size: 618 Bytes

Contents

module Spira::Types

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

    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.float
    register_alias RDF::XSD.double

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spira-2.0.2 lib/spira/types/float.rb
spira-2.0.1 lib/spira/types/float.rb
spira-2.0.0 lib/spira/types/float.rb
spira-1.1.1 lib/spira/types/float.rb
spira-0.7.1 lib/spira/types/float.rb
spira-0.7 lib/spira/types/float.rb
spira-0.5.0 lib/spira/types/float.rb