Class: RDF::Literal::NegativeInteger
- Inherits:
-
NonPositiveInteger
- Object
- Integer
- NonPositiveInteger
- RDF::Literal::NegativeInteger
- 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
-
#-@ ⇒ RDF::Literal::Numeric
Returns
self
negated. - #valid? ⇒ Boolean
Instance Method Details
#-@ ⇒ RDF::Literal::Numeric
Returns self
negated.
43 44 45 46 47 48 |
# File 'lib/rdf/xsd/integer.rb', line 43 def -@ if object != 0 # XXX Raise error? end self.class.new(-self.object) end |
#valid? ⇒ Boolean
50 51 52 |
# File 'lib/rdf/xsd/integer.rb', line 50 def valid? super && @object < 0 end |