Skip to content

Instantly share code, notes, and snippets.

@abrisse
Created October 4, 2011 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abrisse/1261681 to your computer and use it in GitHub Desktop.
Save abrisse/1261681 to your computer and use it in GitHub Desktop.
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 http://rdf.rubyforge.org/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)
end
register_alias XSD.integer
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment