Skip to content

Commit 0d06bb3

Browse files
committed
Finish 3.1.0
2 parents 64711e3 + 43d4393 commit 0d06bb3

File tree

15 files changed

+71
-78
lines changed

15 files changed

+71
-78
lines changed

.travis.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
language: ruby
2-
bundler_args: --without debug
32
script: "bundle exec rspec spec"
4-
before_install:
5-
- 'gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)'
6-
- 'gem update bundler --conservative'
73
env:
84
- CI=true
95
rvm:
10-
- 2.2.2
11-
- 2.3
126
- 2.4
137
- 2.5
148
- 2.6
15-
- jruby-9
16-
- rbx-3
9+
- 2.7
10+
- jruby
1711
cache: bundler
1812
sudo: false
1913
matrix:
2014
allow_failures:
21-
- rvm: jruby-9
22-
- rvm: rbx-3
15+
- rvm: jruby
2316
dist: trusty

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ group :development, :test do
1717
gem 'rdf-vocab', git: "https://github.com/ruby-rdf/rdf-vocab", branch: "develop"
1818
gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
1919
gem "redcarpet", platforms: :ruby
20-
gem 'simplecov', require: false, platform: :mri
21-
gem 'coveralls', require: false, platform: :mri
20+
gem 'simplecov', platforms: :mri
21+
gem 'coveralls', '~> 0.8', platforms: :mri
2222
end

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ This version uses a hand-written parser using the Lexer from the [EBNF][] gem in
8585

8686
## Dependencies
8787

88-
* [Ruby](https://ruby-lang.org/) (>= 2.2)
89-
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.0)
88+
* [Ruby](https://ruby-lang.org/) (>= 2.4)
89+
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
9090
* [EBNF][] (~> 1.1)
9191

9292
## Installation

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.6
1+
3.1.0

lib/rdf/turtle/freebase_reader.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def read_prefix
5555
##
5656
# Read a PNAME of the form `prefix:suffix`.
5757
# @return [RDF::URI]
58-
def read_pname(options = {})
58+
def read_pname(**options)
5959
if pname_str = match(/^(\w+:\S+)/)
6060
ns, suffix = pname_str.split(':', 2)
6161
if suffix[-1,1] == "."

lib/rdf/turtle/reader.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ def self.options
4848
# Redirect for Freebase Reader
4949
#
5050
# @private
51-
def self.new(input = nil, options = {}, &block)
51+
def self.new(input = nil, **options, &block)
5252
klass = if options[:freebase]
5353
FreebaseReader
5454
else
5555
self
5656
end
5757
reader = klass.allocate
58-
reader.send(:initialize, input, options, &block)
58+
reader.send(:initialize, input, **options, &block)
5959
reader
6060
end
6161

@@ -82,7 +82,7 @@ def self.new(input = nil, options = {}, &block)
8282
# @option options [Boolean] :freebase (false)
8383
# Use optimized Freebase reader
8484
# @return [RDF::Turtle::Reader]
85-
def initialize(input = nil, options = {}, &block)
85+
def initialize(input = nil, **options, &block)
8686
super do
8787
@options = {
8888
anon_base: "b0",
@@ -98,7 +98,7 @@ def initialize(input = nil, options = {}, &block)
9898
log_debug("canonicalize") {canonicalize?.inspect}
9999
log_debug("intern") {intern?.inspect}
100100

101-
@lexer = EBNF::LL1::Lexer.new(input, self.class.patterns, @options)
101+
@lexer = EBNF::LL1::Lexer.new(input, self.class.patterns, **@options)
102102

103103
if block_given?
104104
case block.arity
@@ -184,14 +184,14 @@ def process_iri(iri)
184184
end
185185

186186
# Create a literal
187-
def literal(value, options = {})
187+
def literal(value, **options)
188188
log_debug("literal") do
189189
"value: #{value.inspect}, " +
190190
"options: #{options.inspect}, " +
191191
"validate: #{validate?.inspect}, " +
192192
"c14n?: #{canonicalize?.inspect}"
193193
end
194-
RDF::Literal.new(value, options.merge(validate: validate?, canonicalize: canonicalize?))
194+
RDF::Literal.new(value, validate: validate?, canonicalize: canonicalize?, **options)
195195
rescue ArgumentError => e
196196
error("Argument Error #{e.message}", production: :literal, token: @lexer.first)
197197
end
@@ -587,7 +587,7 @@ class SyntaxError < RDF::ReaderError
587587
# @option options [Symbol] :production (nil)
588588
# @option options [String] :token (nil)
589589
# @option options [Integer] :lineno (nil)
590-
def initialize(message, options = {})
590+
def initialize(message, **options)
591591
@production = options[:production]
592592
@token = options[:token]
593593
@lineno = options[:lineno] || (@token.lineno if @token.respond_to?(:lineno))

lib/rdf/turtle/streaming_writer.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ def stream_statement(statement)
2828
if statement.subject != @streaming_subject
2929
@output.puts ' .' if @streaming_subject
3030
@streaming_subject, @streaming_predicate = statement.subject, statement.predicate
31-
@output.write "#{format_term(statement.subject, options)} "
32-
@output.write "#{format_term(statement.predicate, options)} "
31+
@output.write "#{format_term(statement.subject, **options)} "
32+
@output.write "#{format_term(statement.predicate, **options)} "
3333
elsif statement.predicate != @streaming_predicate
3434
@streaming_predicate = statement.predicate
35-
@output.write ";\n#{indent(1)}#{format_term(statement.predicate, options)} "
35+
@output.write ";\n#{indent(1)}#{format_term(statement.predicate, **options)} "
3636
else
3737
@output.write ",\n#{indent(2)}"
3838
end
39-
@output.write("#{format_term(statement.object, options)}")
39+
@output.write("#{format_term(statement.object, **options)}")
4040
end
4141

4242
##

lib/rdf/turtle/writer.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def self.options
123123
# @yieldreturn [void]
124124
# @yield [writer]
125125
# @yieldparam [RDF::Writer] writer
126-
def initialize(output = $stdout, options = {}, &block)
126+
def initialize(output = $stdout, **options, &block)
127127
@graph = RDF::Graph.new
128128
@uri_to_pname = {}
129129
@uri_to_prefix = {}
@@ -272,7 +272,7 @@ def sort_properties(properties)
272272
# @param [RDF::Literal, String, #to_s] literal
273273
# @param [Hash{Symbol => Object}] options
274274
# @return [String]
275-
def format_literal(literal, options = {})
275+
def format_literal(literal, **options)
276276
case literal
277277
when RDF::Literal
278278
case @options[:literal_shorthand] && literal.valid? ? literal.datatype : false
@@ -297,7 +297,7 @@ def format_literal(literal, options = {})
297297
# @param [RDF::URI] uri
298298
# @param [Hash{Symbol => Object}] options
299299
# @return [String]
300-
def format_uri(uri, options = {})
300+
def format_uri(uri, **options)
301301
md = uri.relativize(base_uri)
302302
log_debug("relativize") {"#{uri.to_ntriples} => #{md.inspect}"} if md != uri.to_s
303303
md != uri.to_s ? "<#{md}>" : (get_pname(uri) || "<#{uri}>")
@@ -309,7 +309,7 @@ def format_uri(uri, options = {})
309309
# @param [RDF::Node] node
310310
# @param [Hash{Symbol => Object}] options
311311
# @return [String]
312-
def format_node(node, options = {})
312+
def format_node(node, **options)
313313
options[:unique_bnodes] ? node.to_unique_base : node.to_base
314314
end
315315

@@ -349,7 +349,7 @@ def order_subjects
349349

350350
# Add distinguished classes
351351
top_classes.each do |class_uri|
352-
graph.query(predicate: RDF.type, object: class_uri).
352+
graph.query({predicate: RDF.type, object: class_uri}).
353353
map {|st| st.subject}.
354354
sort.
355355
uniq.
@@ -546,7 +546,7 @@ def p_term(resource, position)
546546
l = if resource == RDF.nil
547547
"()"
548548
else
549-
format_term(resource, options)
549+
format_term(resource, **options)
550550
end
551551
@output.write(l)
552552
end
@@ -595,7 +595,7 @@ def objectList(objects)
595595
# @return [Integer] the number of properties serialized
596596
def predicateObjectList(subject, from_bpl = false)
597597
properties = {}
598-
@graph.query(subject: subject) do |st|
598+
@graph.query({subject: subject}) do |st|
599599
(properties[st.predicate.to_s] ||= []) << st.object
600600
end
601601

rdf-turtle.gemspec

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@ Gem::Specification.new do |gem|
1818
gem.files = %w(AUTHORS README.md History UNLICENSE VERSION) + Dir.glob('lib/**/*.rb')
1919
gem.require_paths = %w(lib)
2020

21-
gem.required_ruby_version = '>= 2.2.2'
21+
gem.required_ruby_version = '>= 2.4'
2222
gem.requirements = []
23-
gem.add_runtime_dependency 'rdf', '~> 3.0'
24-
gem.add_runtime_dependency 'ebnf', '~> 1.1'
25-
gem.add_development_dependency 'rspec', '~> 3.7'
26-
gem.add_development_dependency 'rspec-its', '~> 1.2'
27-
gem.add_development_dependency 'rdf-isomorphic', '~> 3.0'
28-
#gem.add_development_dependency 'json-ld', '~> 3.0'
29-
gem.add_development_dependency 'rdf-spec', '~> 3.0'
30-
gem.add_development_dependency 'rdf-vocab', '~> 3.0'
31-
gem.add_development_dependency 'json-ld', '>= 2.1', '< 4.0'
23+
gem.add_runtime_dependency 'rdf', '~> 3.1'
24+
gem.add_runtime_dependency 'ebnf', '~> 1.2'
25+
gem.add_development_dependency 'rspec', '~> 3.9'
26+
gem.add_development_dependency 'rspec-its', '~> 1.3'
27+
gem.add_development_dependency 'rdf-isomorphic', '~> 3.1'
28+
gem.add_development_dependency 'json-ld', '~> 3.1'
29+
gem.add_development_dependency 'rdf-spec', '~> 3.1'
30+
gem.add_development_dependency 'rdf-vocab', '~> 3.1'
3231

33-
gem.add_development_dependency 'rake', '~> 12.0'
34-
gem.add_development_dependency 'yard' , '~> 0.9.12'
32+
gem.add_development_dependency 'rake', '~> 13.0'
33+
gem.add_development_dependency 'yard' , '~> 0.9.20'
3534
gem.post_install_message = nil
3635
end

script/parse

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require 'rdf/ntriples'
1919
require 'ebnf/ll1/parser'
2020
require 'getoptlong'
2121

22-
def run(input, options)
22+
def run(input, **options)
2323
if options[:profile]
2424
require 'profiler'
2525
end
@@ -31,7 +31,7 @@ def run(input, options)
3131
num = 0
3232
Profiler__::start_profile if options[:profile]
3333
if options[:output_format] == :ntriples || options[:quiet] || options[:benchmark]
34-
r = reader_class.new(input, options[:parser_options])
34+
r = reader_class.new(input, **options[:parser_options])
3535
r.each do |statement|
3636
num += 1
3737
if options[:errors] && statement.invalid?
@@ -45,15 +45,15 @@ def run(input, options)
4545
end
4646
end
4747
elsif options[:output_format] == :inspect
48-
reader_class.new(input, options[:parser_options]).each do |statement|
48+
reader_class.new(input, **options[:parser_options]).each do |statement|
4949
num += 1
5050
options[:output].puts statement.inspect
5151
end
5252
else
53-
r = reader_class.new(input, options[:parser_options])
53+
r = reader_class.new(input, **options[:parser_options])
5454
g = RDF::Graph.new << r
5555
num = g.count
56-
options[:output].puts g.dump(options[:output_format], {prefixes: r.prefixes}.merge(options[:writer_options]))
56+
options[:output].puts g.dump(options[:output_format], prefixes: r.prefixes, **options[:writer_options])
5757
end
5858
if options[:profile]
5959
Profiler__::stop_profile
@@ -137,10 +137,10 @@ end
137137

138138
if ARGV.empty?
139139
s = input ? input : $stdin.read
140-
run(StringIO.new(s), options)
140+
run(StringIO.new(s), **options)
141141
else
142142
ARGV.each do |test_file|
143-
run(Kernel.open(test_file), options)
143+
run(Kernel.open(test_file), **options)
144144
end
145145
end
146146
puts

0 commit comments

Comments
 (0)