Skip to content

Commit 1373b3a

Browse files
committed
Don't use yield in Repository query_execute, use block.call instead, due to an MRI issue. For #216.
1 parent 8447bc7 commit 1373b3a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/rdf/repository.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def has_statement?(statement)
274274
##
275275
# @private
276276
# @see RDF::Enumerable#each_statement
277-
def each_statement
277+
def each_statement(&block)
278278
if block_given?
279279
# Note that to iterate in a more consistent fashion despite
280280
# possible concurrent mutations to `@data`, we use `#dup` to make
@@ -284,7 +284,7 @@ def each_statement
284284
ss.dup.each do |s, ps|
285285
ps.dup.each do |p, os|
286286
os.dup.each do |o|
287-
yield(RDF::Statement.new(s, p, o, :context => c.equal?(DEFAULT_CONTEXT) ? nil : c))
287+
block.call(RDF::Statement.new(s, p, o, :context => c.equal?(DEFAULT_CONTEXT) ? nil : c))
288288
end
289289
end
290290
end
@@ -320,7 +320,7 @@ def each_context(&block)
320320
# Context of `false` matches default context. Unbound variable matches non-false context
321321
# @private
322322
# @see RDF::Queryable#query
323-
def query_pattern(pattern)
323+
def query_pattern(pattern, &block)
324324
context = pattern.context
325325
subject = pattern.subject
326326
predicate = pattern.predicate
@@ -338,7 +338,7 @@ def query_pattern(pattern)
338338
os = os.dup # TODO: is this really needed?
339339
os.each do |o|
340340
next unless object.nil? || object.eql?(o)
341-
yield(RDF::Statement.new(s, p, o, :context => c.equal?(DEFAULT_CONTEXT) ? nil : c))
341+
block.call(RDF::Statement.new(s, p, o, :context => c.equal?(DEFAULT_CONTEXT) ? nil : c))
342342
end
343343
end
344344
end

0 commit comments

Comments
 (0)