Skip to content

Commit

Permalink
Clean up some Ruby warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Jun 19, 2023
1 parent 168ebbb commit 423ee43
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
5 changes: 2 additions & 3 deletions lib/rdf/rdfxml/reader.rb
@@ -1,6 +1,6 @@
begin
require 'nokogiri'
rescue LoadError => e
rescue LoadError
:rexml
end
require 'rdf/xsd'
Expand Down Expand Up @@ -91,7 +91,7 @@ def extract_mappings(element, &cb)
# Produce the next list entry for this context
def li_next
@li_counter += 1
predicate = RDF["_#{@li_counter}"]
RDF["_#{@li_counter}"]
end

# Set XML base. Ignore any fragment
Expand Down Expand Up @@ -328,7 +328,6 @@ def nodeElement(el, ec)
end

# Handle the propertyEltList children events in document order
li_counter = 0 # this will increase for each li we iterate through
el.children.each do |child|
log_fatal "child must be a proxy not a #{child.class}" unless child.is_a?(@implementation::NodeProxy)
next unless child.element?
Expand Down
12 changes: 6 additions & 6 deletions spec/reader_spec.rb
Expand Up @@ -242,7 +242,7 @@
</rdf:RDF>)

expect do
graph = parse(sampledoc, base_uri: "http://example.com", validate: true)
parse(sampledoc, base_uri: "http://example.com", validate: true)
end.to raise_error(RDF::ReaderError)
expect(logger.to_s).to match(/Obsolete attribute .*aboutEach/)
end
Expand All @@ -264,7 +264,7 @@
</rdf:RDF>)

expect do
graph = parse(sampledoc, base_uri: "http://example.com", validate: true)
parse(sampledoc, base_uri: "http://example.com", validate: true)
end.to raise_error(RDF::ReaderError)
expect(logger.to_s).to match(/Obsolete attribute .*aboutEachPrefix/)
end
Expand All @@ -276,7 +276,7 @@
</rdf:RDF>)

expect do
graph = parse(sampledoc, base_uri: "http://example.com", validate: true)
parse(sampledoc, base_uri: "http://example.com", validate: true)
end.to raise_error(RDF::ReaderError)
expect(logger.to_s).to match(/ID addtribute '.*' must be a NCName/)
end
Expand All @@ -291,7 +291,7 @@
</rdf:RDF>)

expect do
graph = parse(sampledoc, base_uri: "http://example.com", validate: true)
parse(sampledoc, base_uri: "http://example.com", validate: true)
end.to raise_error(RDF::ReaderError)
expect(logger.to_s).to match(/ID addtribute '.*' must be a NCName/)
end
Expand All @@ -304,7 +304,7 @@
</rdf:RDF>)

expect do
graph = parse(sampledoc, base_uri: "http://example.com", validate: true)
parse(sampledoc, base_uri: "http://example.com", validate: true)
end.to raise_error(RDF::ReaderError)
expect(logger.to_s).to include("ID addtribute 'a/b' must be a NCName")
end
Expand All @@ -316,7 +316,7 @@
</rdf:RDF>)

expect do
graph = parse(sampledoc, base_uri: "http://example.com", validate: true)
parse(sampledoc, base_uri: "http://example.com", validate: true)
end.to raise_error(RDF::ReaderError)
expect(logger.to_s).to match(/Obsolete attribute .*bagID/)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -11,7 +11,7 @@
require 'matchers'
begin
require 'nokogiri'
rescue LoadError => e
rescue LoadError
:rexml
end
begin
Expand All @@ -32,6 +32,7 @@
end
rescue LoadError
end

require 'rdf/rdfxml'

::RSpec.configure do |c|
Expand Down
9 changes: 4 additions & 5 deletions spec/writer_spec.rb
Expand Up @@ -517,8 +517,8 @@ class FOO < RDF::Vocabulary("http://foo/"); end
end
end

specify { expect(subject).to match /<Release/ }
specify { expect(subject).to match /<pred/ }
specify { expect(subject).to match(/<Release/) }
specify { expect(subject).to match(/<pred/) }
end

context "nil namespace" do
Expand All @@ -534,8 +534,8 @@ class FOO < RDF::Vocabulary("http://foo/"); end
end
end

specify { expect(subject).to match /<Release/ }
specify { expect(subject).to match /<pred/ }
specify { expect(subject).to match(/<Release/) }
specify { expect(subject).to match(/<pred/) }
end
end

Expand Down Expand Up @@ -724,7 +724,6 @@ def serialize(ntstr, **options)
writer << g
end
require 'cgi'
puts CGI.escapeHTML(result) if $verbose
result
end
end
Expand Down

0 comments on commit 423ee43

Please sign in to comment.