Sha256: b8154be4b4de3dcb4c619c0129f8720be352d049ce97a67dedd2c42272771f0e

Contents?: true

Size: 603 Bytes

Versions: 12

Compression:

Stored size: 603 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 => XSD.double)
    end

    register_alias XSD.float
    register_alias XSD.double

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spira-0.0.12 lib/spira/types/float.rb
spira-0.0.11 lib/spira/types/float.rb
spira-0.0.10 lib/spira/types/float.rb
spira-0.0.9 lib/spira/types/float.rb
spira-0.0.8 lib/spira/types/float.rb
spira-0.0.7 lib/spira/types/float.rb
spira-0.0.6 lib/spira/types/float.rb
spira-0.0.5 lib/spira/types/float.rb
spira-0.0.4 lib/spira/types/float.rb
spira-0.0.3 lib/spira/types/float.rb
spira-0.0.2 lib/spira/types/float.rb
spira-0.0.1 lib/spira/types/float.rb