Class: RDF::Literal::NonPositiveInteger

Inherits:
Integer
  • Object
show all
Defined in:
lib/rdf/xsd/integer.rb

Overview

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

Direct Known Subclasses

NegativeInteger

Constant Summary collapse

DATATYPE =
RDF::XSD.nonPositiveInteger
GRAMMAR =
/^(?:[\+\-]?0)|(?:-\d+)$/.freeze

Instance Method Summary collapse

Instance Method Details

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

Returns self negated.

Since:

  • 0.2.3


18
19
20
21
22
23
# File 'lib/rdf/xsd/integer.rb', line 18

def [email protected]
  if object != 0
    # XXX Raise error?
  end
  super
end

#valid?Boolean


25
26
27
# File 'lib/rdf/xsd/integer.rb', line 25

def valid?
  super && @object <= 0
end