Skip to content

Commit

Permalink
Finish 2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Jan 24, 2017
2 parents 2360386 + bf070ff commit 49fc57e
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 31 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.2.1
2.2.2
10 changes: 2 additions & 8 deletions lib/rdf.rb
Expand Up @@ -89,18 +89,12 @@ def self.Node(*args, &block)
end

##
# Alias for `RDF::URI.new`.
# Cast to a URI. If already a URI, return the passed argument.
#
# @param (see RDF::URI#initialize)
# @return [RDF::URI]
def self.URI(*args, &block)
case uri = args.first
when RDF::URI then uri
else case
when uri.respond_to?(:to_uri) then uri.to_uri
else URI.new(*args, &block)
end
end
(uri = args.first).respond_to?(:to_uri) ? uri.to_uri : URI.new(*args, &block)
end

##
Expand Down
5 changes: 4 additions & 1 deletion lib/rdf/mixin/enumerable.rb
Expand Up @@ -765,7 +765,10 @@ def dump(*args, **options)
def method_missing(meth, *args)
case meth
when :to_hash
warn "[DEPRECATION] Enumerable#to_hash is deprecated, use Enumerable#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
warn "[DEPRECATION] RDF::Enumerable#to_hash is deprecated, use RDF::Enumerable#to_h instead.\n" +
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
"Called from #{Gem.location_of_caller.join(':')}"
return self.to_h
end
writer = RDF::Writer.for(meth.to_s[3..-1].to_sym) if meth.to_s[0,3] == "to_"
Expand Down
5 changes: 4 additions & 1 deletion lib/rdf/model/statement.rb
Expand Up @@ -426,7 +426,10 @@ def reified(subject: nil, id: nil, graph_name: nil)
def method_missing(meth, *args)
case meth
when :to_hash
warn "[DEPRECATION] Statement#to_hash is deprecated, use Statement#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
warn "[DEPRECATION] RDF::Statement#to_hash is deprecated, use RDF::Statement#to_h instead.\n" +
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
"Called from #{Gem.location_of_caller.join(':')}"
self.to_h
else
super
Expand Down
5 changes: 4 additions & 1 deletion lib/rdf/model/uri.rb
Expand Up @@ -1299,7 +1299,10 @@ def format_authority
def method_missing(meth, *args)
case meth
when :to_hash
warn "[DEPRECATION] URI#to_hash is deprecated, use URI#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
warn "[DEPRECATION] RDF::URI#to_hash is deprecated, use RDF::URI#to_h instead.\n" +
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
"Called from #{Gem.location_of_caller.join(':')}"
self.to_h
else
super
Expand Down
5 changes: 4 additions & 1 deletion lib/rdf/query/solution.rb
Expand Up @@ -277,7 +277,10 @@ def inspect
# @return [RDF::Term]
def method_missing(name, *args, &block)
if name == :to_hash
warn "[DEPRECATION] Solution#to_hash is deprecated, use Solution#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
warn "[DEPRECATION] RDF::Query::Solution#to_hash is deprecated, use RDF::Query::Solution#to_h instead.\n" +
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
"Called from #{Gem.location_of_caller.join(':')}"
self.to_h
elsif args.empty? && @bindings.has_key?(name.to_sym)
@bindings[name.to_sym]
Expand Down
5 changes: 4 additions & 1 deletion lib/rdf/query/variable.rb
Expand Up @@ -229,7 +229,10 @@ def to_s
# @deprecated Use {#to_h} instead.
def method_missing(name, *args, &block)
if name == :to_hash
warn "[DEPRECATION] Variable#to_hash is deprecated, use Variable#to_h instead. Called from #{Gem.location_of_caller.join(':')}"
warn "[DEPRECATION] RDF::Query::Variable#to_hash is deprecated, use RDF::Query::Variable#to_h instead.\n" +
"This is due to the introduction of keyword arugments that attempt to turn the last argument into a hash using #to_hash.\n" +
"This can be avoided by explicitly passing an options hash as the last argument.\n" +
"Called from #{Gem.location_of_caller.join(':')}"
self.to_h
elsif args.empty? && @bindings.has_key?(name.to_sym)
@bindings[name.to_sym]
Expand Down
4 changes: 2 additions & 2 deletions lib/rdf/reader.rb
Expand Up @@ -50,7 +50,7 @@ class Reader
# @yieldparam [Class] klass
# @return [Enumerator]
def self.each(&block)
@@subclasses.each(&block)
RDF::Format.map(&:reader).reject(&:nil?).each(&block)
end

##
Expand Down Expand Up @@ -195,7 +195,7 @@ def self.open(filename, format: nil, **options, &block)
if reader
reader.new(file, options, &block)
else
raise FormatError, "unknown RDF format: #{format_options.inspect}\nThis may be resolved with a require of the 'linkeddata' gem."
raise FormatError, "unknown RDF format: #{format_options.inspect}" + ("\nThis may be resolved with a require of the 'linkeddata' gem." unless Object.const_defined?(:LinkedData))
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/rdf/repository.rb
Expand Up @@ -43,16 +43,16 @@ module RDF
# Repositories support transactions with a variety of ACID semantics:
#
# Atomicity is indicated by `#supports?(:atomic_write)`. When atomicity is
# supported, writes through `#transaction`, `#apply_changeset` and
# `#delete_insert` are applied atomically.
# supported, writes through {#transaction}, {#apply_changeset} and
# {#delete_insert} are applied atomically.
#
# Consistency should be guaranteed, in general. Repositories that don't
# support consistency, or that have specialized definitions of consistency
# above those declared by the RDF data model, should advertise this fact in
# their documentation.
#
# Isolation may be supported at various levels, indicated by
# `#isolation_level`:
# {#isolation_level}:
# - `:read_uncommitted`: Inserts & deletes in an uncommitted transaction
# scope may be visible to other transactions (or via `#each`, etc...)
# - `:read_committed`: Inserts & deletes may be visible to other
Expand All @@ -64,8 +64,8 @@ module RDF
# When two or more transactions attempt conflicting writes, only one of
# them may succeed.
#
# Durability is noted via `RDF::Durable` support and `#durable?`
# /`#nondurable?`.
# Durability is noted via {RDF::Durable} support and {#durable?}
# /{#nondurable?}.
#
# @example Transational read from a repository
# repository.transaction do |tx|
Expand Down
14 changes: 7 additions & 7 deletions lib/rdf/transaction.rb
Expand Up @@ -39,21 +39,21 @@ module RDF
# end
#
# The base class provides an atomic write implementation depending on
# `RDF::Changeset` and using `Changeset#apply`. Custom `Repositories`
# {RDF::Changeset} and using {Changeset#apply}. Custom {Repository} classes
# can implement a minimial write-atomic transactions by overriding
# `#apply_changeset`.
# {#apply_changeset}.
#
# Reads within a transaction run against the live repository by default
# (`#isolation_level' is `:read_committed`). Repositories may provide support
# for snapshots by implementing `Repository#snapshot` and responding `true` to
# ({#isolation_level} is `:read_committed`). Repositories may provide support
# for snapshots by implementing {Repository#snapshot} and responding `true` to
# `#supports?(:snapshots)`. In this case, the transaction will use the
# `RDF::Dataset` returned by `#snapshot` for reads (`:repeatable_read`).
# {RDF::Dataset} returned by {#snapshot} for reads (`:repeatable_read`).
#
# For datastores that support transactions natively, implementation of a
# custom `Transaction` subclass is recommended. The `Repository` is
# custom {Transaction} subclass is recommended. The {Repository} is
# responsible for specifying snapshot support and isolation level as
# appropriate. Note that repositories may provide the snapshot isolation level
# without implementing `#snapshot`.
# without implementing {#snapshot}.
#
# @example A repository with a custom transaction class
# class MyRepository < RDF::Repository
Expand Down
2 changes: 1 addition & 1 deletion lib/rdf/writer.rb
Expand Up @@ -61,7 +61,7 @@ class Writer
# @yieldreturn [void] ignored
# @return [Enumerator]
def self.each(&block)
@@subclasses.each(&block)
RDF::Format.map(&:writer).reject(&:nil?).each(&block)
end

##
Expand Down
4 changes: 2 additions & 2 deletions spec/vocabulary_spec.rb
Expand Up @@ -4,7 +4,7 @@
VOCABS = %w(owl rdf rdfs xsd)
STRICT_VOCABS = %w(owl rdf rdfs)

context "#new" do
context "#initialize" do
it "should require one argument" do
expect { RDF::Vocabulary.new }.to raise_error(ArgumentError)
expect { RDF::Vocabulary.new("http://example.org/") }.not_to raise_error
Expand Down Expand Up @@ -34,7 +34,7 @@
end
end

describe "#each" do
describe ".each" do
it "inumerates pre-defined vocabularies" do
expect {|b| RDF::Vocabulary.each(&b)}.to yield_control.at_least(3).times
expect(RDF::Vocabulary.each.to_a).to include(RDF, RDF::RDFS, RDF::OWL)
Expand Down

0 comments on commit 49fc57e

Please sign in to comment.