class RDF::N3::Algebra::Math::Ceiling

The object is calculated as the subject upwards to a whole number.

@see www.w3.org/TR/xpath-functions/#func-ceiling

Constants

NAME
URI

Public Instance Methods

resolve(resource, position:) click to toggle source

The math:ceiling operator takes string or number and calculates its ceiling.

@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate

# 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