Sha256: 532a1f53a24b548f62f1578bb48c1590757e7f6bcc97624447265d180bb42b2b

Contents?: true

Size: 758 Bytes

Versions: 4

Compression:

Stored size: 758 Bytes

Contents

module RDF::N3::Algebra::List
  ##
  # Iff the subject is a list and the object is the last thing that list, then this is true. The object can be calculated as a function of the list.
  #
  # @example
  #     { ( 1 2 3 4 5 6 ) list:last 6 } => { :test1 a :SUCCESS }.
  #
  # The object can be calculated as a function of the list.
  class Last < RDF::N3::Algebra::ListOperator
    NAME = :listLast
    URI = RDF::N3::List.last

    ##
    # Resolves this operator using the given variable `bindings`.
    # If the last operand is a variable, it creates a solution for each element in the list.
    #
    # @param [RDF::N3::List] list
    # @return [RDF::Term]
    # @see RDF::N3::ListOperator#evaluate
    def resolve(list)
      list.last
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rdf-n3-3.3.0 lib/rdf/n3/algebra/list/last.rb
rdf-n3-3.2.1 lib/rdf/n3/algebra/list/last.rb
rdf-n3-3.2.0 lib/rdf/n3/algebra/list/last.rb
rdf-n3-3.1.2 lib/rdf/n3/algebra/list/last.rb