Class: RDF::N3::Algebra::Str::Format

Inherits:
ListOperator
  • Object
show all
Includes:
Builtin
Defined in:
lib/rdf/n3/algebra/str/format.rb

Overview

The subject is a list, whose first member is a format string, and whose remaining members are arguments to the format string. The formating string is in the style of python’s % operator, very similar to C’s sprintf(). The object is calculated from the subject.

Constant Summary collapse

NAME =
:strFormat
URI =
RDF::N3::Str.format

Instance Attribute Summary

Attributes included from Enumerable

#existentials, #universals

Instance Method Summary collapse

Methods included from Builtin

#each, #evaluate, #hash, #input_operand, #rank, #to_uri

Methods inherited from ListOperator

#as_literal, #execute, #input_operand, #validate

Instance Method Details

#resolve(list) ⇒ RDF::Term

Parameters:

Returns:

See Also:

  • ListOperator#evaluate


12
13
14
15
# File 'lib/rdf/n3/algebra/str/format.rb', line 12

def resolve(list)
  format, *args = list.to_a.map(&:value)
  str = RDF::Literal(format % args)
end