Module: Spira::Type::ClassMethods

Defined in:
lib/spira/type.rb

Instance Method Summary collapse

Instance Method Details

#register_alias(identifier) ⇒ Void

Register an alias that this type can be referred to as, such as an RDF URI. The alias can be any object, symbol, or constant.

Parameters:

  • identifier (Any)

    The new alias in property declarations for this class

Returns:

  • (Void)

58
59
60
# File 'lib/spira/type.rb', line 58

def register_alias(identifier)
  Spira.type_alias(identifier, self)
end

#serialize(value) ⇒ RDF::Value

Serialize a given value to RDF.

Parameters:

  • value (Any)

    The Ruby value to be serialized

Returns:

  • (RDF::Value)

    The RDF form of this value


67
68
69
# File 'lib/spira/type.rb', line 67

def serialize(value)
  value
end

#unserialize(value) ⇒ Any

Unserialize a given RDF value to Ruby

Parameters:

  • value (RDF::Value)

    The RDF form of this value

Returns:

  • (Any)

    The Ruby form of this value


76
77
78
# File 'lib/spira/type.rb', line 76

def unserialize(value)
  value
end