Skip to content

Commit 20dc5f6

Browse files
committed
Release 1.1.17.1:
* Don't use yield in Repository query_execute, use block.call instead, due to an MRI issue.
2 parents 8447bc7 + 45d75b7 commit 20dc5f6

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.17
1+
1.1.17.1

lib/rdf/repository.rb

Lines changed: 5 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,8 @@ 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+
# FIXME: yield has better performance, but broken in MRI 2.2: See https://bugs.ruby-lang.org/issues/11451.
288+
block.call(RDF::Statement.new(s, p, o, :context => c.equal?(DEFAULT_CONTEXT) ? nil : c))
288289
end
289290
end
290291
end
@@ -320,7 +321,7 @@ def each_context(&block)
320321
# Context of `false` matches default context. Unbound variable matches non-false context
321322
# @private
322323
# @see RDF::Queryable#query
323-
def query_pattern(pattern)
324+
def query_pattern(pattern, &block)
324325
context = pattern.context
325326
subject = pattern.subject
326327
predicate = pattern.predicate
@@ -338,7 +339,7 @@ def query_pattern(pattern)
338339
os = os.dup # TODO: is this really needed?
339340
os.each do |o|
340341
next unless object.nil? || object.eql?(o)
341-
yield(RDF::Statement.new(s, p, o, :context => c.equal?(DEFAULT_CONTEXT) ? nil : c))
342+
block.call(RDF::Statement.new(s, p, o, :context => c.equal?(DEFAULT_CONTEXT) ? nil : c))
342343
end
343344
end
344345
end

0 commit comments

Comments
 (0)