Method: RDF::Reader#each_triple

Defined in:
lib/rdf/reader.rb

#each_triple {|subject, predicate, object| ... } ⇒ void #each_tripleEnumerator

This method returns an undefined value.

Iterates the given block for each RDF triple.

If no block was given, returns an enumerator.

Triples are yielded in the order that they are read from the input stream.

Overloads:

  • #each_triple {|subject, predicate, object| ... } ⇒ void

    This method returns an undefined value.

    Yields:

    • (subject, predicate, object)

      each triple

    Yield Parameters:

    Yield Returns:

    • (void)

      ignored

  • #each_tripleEnumerator

    Returns:

See Also:



479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/rdf/reader.rb', line 479

def each_triple(&block)
  if block_given?
    begin
      loop do
        triple = read_triple
        block.call(*triple) unless triple.nil?
      end
    rescue EOFError
      rewind rescue nil
    end
  end
  enum_for(:each_triple)
end