Class: RDF::N3::Algebra::Math::Ceiling
- Inherits:
-
ResourceOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Math::Ceiling
- Defined in:
- lib/rdf/n3/algebra/math/ceiling.rb
Overview
The object is calculated as the subject upwards to a whole number.
Constant Summary collapse
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#resolve(resource, position:) ⇒ RDF::Term
The math:ceiling operator takes string or number and calculates its ceiling.
Methods inherited from ResourceOperator
#as_literal, #execute, #input_operand, #valid?
Methods included from Builtin
#each, #evaluate, #hash, #input_operand, #rank, #to_uri
Instance Method Details
#resolve(resource, position:) ⇒ RDF::Term
The math:ceiling operator takes string or number and calculates its ceiling.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rdf/n3/algebra/math/ceiling.rb', line 17 def resolve(resource, position:) case position when :subject return nil unless resource.literal? as_literal(resource.as_number.ceil) when :object return nil unless resource.literal? || resource.variable? resource end end |