Skip to content

Commit 49fc57e

Browse files
committed
Finish 2.2.2
2 parents 2360386 + bf070ff commit 49fc57e

12 files changed

Lines changed: 40 additions & 31 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.1
1+
2.2.2

lib/rdf.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,12 @@ def self.Node(*args, &block)
8989
end
9090

9191
##
92-
# Alias for `RDF::URI.new`.
92+
# Cast to a URI. If already a URI, return the passed argument.
9393
#
9494
# @param (see RDF::URI#initialize)
9595
# @return [RDF::URI]
9696
def self.URI(*args, &block)
97-
case uri = args.first
98-
when RDF::URI then uri
99-
else case
100-
when uri.respond_to?(:to_uri) then uri.to_uri
101-
else URI.new(*args, &block)
102-
end
103-
end
97+
(uri = args.first).respond_to?(:to_uri) ? uri.to_uri : URI.new(*args, &block)
10498
end
10599

106100
##

lib/rdf/mixin/enumerable.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,10 @@ def dump(*args, **options)
765765
def method_missing(meth, *args)
766766
case meth
767767
when :to_hash
768-
warn "[DEPRECATION] Enumerable#to_hash is deprecated, use Enumerable#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
768+
warn "[DEPRECATION] RDF::Enumerable#to_hash is deprecated, use RDF::Enumerable#to_h instead.\n" +
769+
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
770+
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
771+
"Called from #{Gem.location_of_caller.join(':')}"
769772
return self.to_h
770773
end
771774
writer = RDF::Writer.for(meth.to_s[3..-1].to_sym) if meth.to_s[0,3] == "to_"

lib/rdf/model/statement.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,10 @@ def reified(subject: nil, id: nil, graph_name: nil)
426426
def method_missing(meth, *args)
427427
case meth
428428
when :to_hash
429-
warn "[DEPRECATION] Statement#to_hash is deprecated, use Statement#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
429+
warn "[DEPRECATION] RDF::Statement#to_hash is deprecated, use RDF::Statement#to_h instead.\n" +
430+
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
431+
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
432+
"Called from #{Gem.location_of_caller.join(':')}"
430433
self.to_h
431434
else
432435
super

lib/rdf/model/uri.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,10 @@ def format_authority
12991299
def method_missing(meth, *args)
13001300
case meth
13011301
when :to_hash
1302-
warn "[DEPRECATION] URI#to_hash is deprecated, use URI#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
1302+
warn "[DEPRECATION] RDF::URI#to_hash is deprecated, use RDF::URI#to_h instead.\n" +
1303+
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
1304+
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
1305+
"Called from #{Gem.location_of_caller.join(':')}"
13031306
self.to_h
13041307
else
13051308
super

lib/rdf/query/solution.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ def inspect
277277
# @return [RDF::Term]
278278
def method_missing(name, *args, &block)
279279
if name == :to_hash
280-
warn "[DEPRECATION] Solution#to_hash is deprecated, use Solution#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
280+
warn "[DEPRECATION] RDF::Query::Solution#to_hash is deprecated, use RDF::Query::Solution#to_h instead.\n" +
281+
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
282+
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
283+
"Called from #{Gem.location_of_caller.join(':')}"
281284
self.to_h
282285
elsif args.empty? && @bindings.has_key?(name.to_sym)
283286
@bindings[name.to_sym]

lib/rdf/query/variable.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ def to_s
229229
# @deprecated Use {#to_h} instead.
230230
def method_missing(name, *args, &block)
231231
if name == :to_hash
232-
warn "[DEPRECATION] Variable#to_hash is deprecated, use Variable#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
232+
warn "[DEPRECATION] RDF::Query::Variable#to_hash is deprecated, use RDF::Query::Variable#to_h instead.\n" +
233+
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
234+
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
235+
"Called from #{Gem.location_of_caller.join(':')}"
233236
self.to_h
234237
elsif args.empty? && @bindings.has_key?(name.to_sym)
235238
@bindings[name.to_sym]

lib/rdf/reader.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Reader
5050
# @yieldparam [Class] klass
5151
# @return [Enumerator]
5252
def self.each(&block)
53-
@@subclasses.each(&block)
53+
RDF::Format.map(&:reader).reject(&:nil?).each(&block)
5454
end
5555

5656
##
@@ -195,7 +195,7 @@ def self.open(filename, format: nil, **options, &block)
195195
if reader
196196
reader.new(file, options, &block)
197197
else
198-
raise FormatError, "unknown RDF format: #{format_options.inspect}\nThis may be resolved with a require of the 'linkeddata' gem."
198+
raise FormatError, "unknown RDF format: #{format_options.inspect}" + ("\nThis may be resolved with a require of the 'linkeddata' gem." unless Object.const_defined?(:LinkedData))
199199
end
200200
end
201201
end

lib/rdf/repository.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ module RDF
4343
# Repositories support transactions with a variety of ACID semantics:
4444
#
4545
# Atomicity is indicated by `#supports?(:atomic_write)`. When atomicity is
46-
# supported, writes through `#transaction`, `#apply_changeset` and
47-
# `#delete_insert` are applied atomically.
46+
# supported, writes through {#transaction}, {#apply_changeset} and
47+
# {#delete_insert} are applied atomically.
4848
#
4949
# Consistency should be guaranteed, in general. Repositories that don't
5050
# support consistency, or that have specialized definitions of consistency
5151
# above those declared by the RDF data model, should advertise this fact in
5252
# their documentation.
5353
#
5454
# Isolation may be supported at various levels, indicated by
55-
# `#isolation_level`:
55+
# {#isolation_level}:
5656
# - `:read_uncommitted`: Inserts & deletes in an uncommitted transaction
5757
# scope may be visible to other transactions (or via `#each`, etc...)
5858
# - `:read_committed`: Inserts & deletes may be visible to other
@@ -64,8 +64,8 @@ module RDF
6464
# When two or more transactions attempt conflicting writes, only one of
6565
# them may succeed.
6666
#
67-
# Durability is noted via `RDF::Durable` support and `#durable?`
68-
# /`#nondurable?`.
67+
# Durability is noted via {RDF::Durable} support and {#durable?}
68+
# /{#nondurable?}.
6969
#
7070
# @example Transational read from a repository
7171
# repository.transaction do |tx|

lib/rdf/transaction.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@ module RDF
3939
# end
4040
#
4141
# The base class provides an atomic write implementation depending on
42-
# `RDF::Changeset` and using `Changeset#apply`. Custom `Repositories`
42+
# {RDF::Changeset} and using {Changeset#apply}. Custom {Repository} classes
4343
# can implement a minimial write-atomic transactions by overriding
44-
# `#apply_changeset`.
44+
# {#apply_changeset}.
4545
#
4646
# Reads within a transaction run against the live repository by default
47-
# (`#isolation_level' is `:read_committed`). Repositories may provide support
48-
# for snapshots by implementing `Repository#snapshot` and responding `true` to
47+
# ({#isolation_level} is `:read_committed`). Repositories may provide support
48+
# for snapshots by implementing {Repository#snapshot} and responding `true` to
4949
# `#supports?(:snapshots)`. In this case, the transaction will use the
50-
# `RDF::Dataset` returned by `#snapshot` for reads (`:repeatable_read`).
50+
# {RDF::Dataset} returned by {#snapshot} for reads (`:repeatable_read`).
5151
#
5252
# For datastores that support transactions natively, implementation of a
53-
# custom `Transaction` subclass is recommended. The `Repository` is
53+
# custom {Transaction} subclass is recommended. The {Repository} is
5454
# responsible for specifying snapshot support and isolation level as
5555
# appropriate. Note that repositories may provide the snapshot isolation level
56-
# without implementing `#snapshot`.
56+
# without implementing {#snapshot}.
5757
#
5858
# @example A repository with a custom transaction class
5959
# class MyRepository < RDF::Repository

0 commit comments

Comments
 (0)