Class: RDF::Literal::NegativeInteger

Inherits:
NonPositiveInteger show all
Defined in:
lib/rdf/xsd/integer.rb

Overview

negativeInteger is derived from nonPositiveInteger by setting the value of maxInclusive to be -1. This results in the standard mathematical concept of the negative integers. The value space of negativeInteger is the infinite set .....,-2,-1. The base type of negativeInteger is nonPositiveInteger.

Constant Summary collapse

GRAMMAR =
/^\-\d+$/.freeze
DATATYPE =
RDF::XSD.negativeInteger

Instance Method Summary collapse

Instance Method Details

#[email protected]RDF::Literal::Numeric

Returns self negated.

Returns:

  • (RDF::Literal::Numeric)

Since:

  • 0.2.3


45
46
47
48
49
50
# File 'lib/rdf/xsd/integer.rb', line 45

def [email protected]
  if object != 0
    # XXX Raise error?
  end
  self.class.new(-self.object)
end

#valid?Boolean

Returns:

  • (Boolean)

52
53
54
# File 'lib/rdf/xsd/integer.rb', line 52

def valid?
  super && @object < 0
end