Sha256: 7cadbb95f0ae048596e3028ac841e9c456d7ad7d131538af050b731ffa20b274

Contents?: true

Size: 659 Bytes

Versions: 1

Compression:

Stored size: 659 Bytes

Contents

module Spira::Types

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

    include Spira::Type

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

    def self.serialize(value)
      RDF::Literal.new(value, datatype: XSD.nonNegativeInteger)
    end

    register_alias RDF::XSD.nonNegativeInteger

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spira-3.1.1 lib/spira/types/nonNegativeInteger.rb