class RDF::N3::Algebra::Math::Quotient
The subject is a pair of numbers. The object is calculated by dividing the first number of the pair by the second.
Constants
- NAME
- URI
Public Instance Methods
Source
# File lib/rdf/n3/algebra/math/quotient.rb, line 17 def resolve(list) list.to_a.map(&:as_number).reduce(&:/) end
The math:quotient operator takes a pair of strings or numbers and calculates their quotient.
@param [RDF::N3::List] list @return [RDF::Term] @see RDF::N3::ListOperator#evaluate
Source
# File lib/rdf/n3/algebra/math/quotient.rb, line 27 def validate(list) if super && list.all? {|le| le.is_a?(RDF::Literal)} && list.length == 2 true else log_error(NAME) {"list is not a pair of literals: #{list.to_sxp}"} false end end
The list argument must be a pair of literals.
@param [RDF::N3::List] list @return [Boolean] @see RDF::N3::ListOperator#validate
Calls superclass method
RDF::N3::Algebra::ListOperator#validate