Sha256: 5a4ee68e962fbf1e2f3e272f559a45063ed310bdf806d1f568d5e3756c77ef8b
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
module Redlander # Wrapper for a librdf_stream object. module StatementIterator include Enumerable # Iterate over statements in the stream. def each # TODO: The options specify matching criteria: subj, pred, obj; # if an option is not specified, it matches any value, # so with no options given, all statements will be returned. if block_given? while Redland.librdf_stream_end(@rdf_stream).zero? yield current Redland.librdf_stream_next(@rdf_stream).zero? end else raise ::LocalJumpError.new("no block given") end end private # Get the current Statement in the stream. def current rdf_statement = Redland.librdf_stream_get_object(@rdf_stream) statement = Statement.new(rdf_statement) # not using Statement#model= in order to avoid re-adding the statement to the model statement.instance_variable_set(:@model, @model) statement end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redlander-0.2.2 | lib/redlander/statement_iterator.rb |
redlander-0.2.1 | lib/redlander/statement_iterator.rb |