Class: Spira::Types::Boolean
- Inherits:
-
Object
- Object
- Spira::Types::Boolean
- Includes:
- Spira::Type
- Defined in:
- lib/spira/types/boolean.rb
Overview
A Spira::Type for Boolean values. Values will be expressed as booleans and packaged as XSD.boolean
RDF::Literal
s.
A Resource property can reference this type as Spira::Types::Boolean
, Boolean
, or XSD.boolean
.
Class Method Summary collapse
Class Method Details
.serialize(value) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/spira/types/boolean.rb', line 20 def self.serialize(value) if value RDF::Literal.new(true, datatype: RDF::XSD.boolean) else RDF::Literal.new(false, datatype: RDF::XSD.boolean) end end |
.unserialize(value) ⇒ Object
16 17 18 |
# File 'lib/spira/types/boolean.rb', line 16 def self.unserialize(value) value.object == true end |