Sha256: c77e6bd1566e1446fc66ece5e8d0fbf5a5e2196285ea6d2c872c0c0fc7ae87aa

Contents?: true

Size: 576 Bytes

Versions: 1

Compression:

Stored size: 576 Bytes

Contents

module Spira::Types

  ##
  # A {Spira::Type} for integer values.  Values will be associated with the
  # `XSD.integer` type.
  #
  # A {Spira::Resource} property can reference this type as
  # `Spira::Types::Integer`, `Integer`, or `XSD.integer`.
  #
  # @see Spira::Type
  # @see https://ruby-rdf.github.io/rdf/RDF/Literal.html
  class Integer

    include Spira::Type

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

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

    register_alias RDF::XSD.integer

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spira-3.3.0 lib/spira/types/integer.rb