Sha256: 2aa18dc49eab9ba604f49ecefa5c8d65252974c60a4ac3bea540a381a3687dbb

Contents?: true

Size: 549 Bytes

Versions: 5

Compression:

Stored size: 549 Bytes

Contents

module Spira::Types

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

    def self.unserialize(value)
      object = value.object.to_time
    end

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

    register_alias XSD.time

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spira-3.1.0 lib/spira/types/time.rb
spira-3.0.0 lib/spira/types/time.rb
spira-2.1.0 lib/spira/types/time.rb
spira-2.0.2 lib/spira/types/time.rb
spira-2.0.1 lib/spira/types/time.rb