Class: RDF::Literal::NonPositiveInteger

Inherits:
Integer show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/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

Methods inherited from Integer

#to_sxp

Instance Method Details

#-@RDF::Literal::Numeric

Returns self negated.

Returns:

  • (RDF::Literal::Numeric)


17
18
19
20
21
22
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/integer.rb', line 17

def -@
  if object != 0
    # XXX Raise error?
  end
  super
end

#valid?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/integer.rb', line 24

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