Sha256: 2ebe305133ba8395e7d80ac2b7d0ea120018a4fecdcbc781d1602fa29d70f652

Contents?: true

Size: 791 Bytes

Versions: 4

Compression:

Stored size: 791 Bytes

Contents

module RDF::N3::Algebra::Math
  ##
  # The object is calulated as the inverse hyperbolic cosine value of the subject.
  class ACosH < RDF::N3::Algebra::ResourceOperator
    NAME = :mathACosH
    URI = RDF::N3::Math.acosh

    ##
    # The math:acosh operator takes string or number and calculates its inverse hyperbolic cosine.
    #
    # @param [RDF::Term] resource
    # @param [:subject, :object] position
    # @return [RDF::Term]
    # @see RDF::N3::ResourceOperator#evaluate
    def resolve(resource, position:)
      case position
      when :subject
        return nil unless resource.literal?
        as_literal(Math.acosh(resource.as_number.object))
      when :object
        return nil unless resource.literal? || resource.variable?
        resource
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rdf-n3-3.3.0 lib/rdf/n3/algebra/math/acosh.rb
rdf-n3-3.2.1 lib/rdf/n3/algebra/math/acosh.rb
rdf-n3-3.2.0 lib/rdf/n3/algebra/math/acosh.rb
rdf-n3-3.1.2 lib/rdf/n3/algebra/math/acosh.rb