Skip to content

Commit aff8042

Browse files
committed
Update some calling sequences.
1 parent add36ff commit aff8042

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

lib/rdf/turtle/writer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
@@ -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

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

script/tc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require 'getoptlong'
1212
ASSERTOR = "https://greggkellogg.net/foaf#me"
1313
RUN_TIME = Time.now
1414

15-
def earl_preamble(options)
15+
def earl_preamble(**options)
1616
options[:output].write File.read(File.expand_path("../../etc/doap#{'-ntriples' if options[:ntriples]}.ttl", __FILE__))
1717
options[:output].puts %(
1818
<> foaf:primaryTopic <https://rubygems.org/gems/rdf#{'-turtle' unless options[:ntriples]}> ;
@@ -43,7 +43,7 @@ def earl_preamble(options)
4343
)
4444
end
4545

46-
def run_tc(tc, options)
46+
def run_tc(tc, **options)
4747
STDERR.write "run #{tc.name}"
4848

4949
if options[:verbose]
@@ -64,7 +64,7 @@ def run_tc(tc, options)
6464
logger: logger
6565
}.merge(options)
6666

67-
reader = RDF::Reader.for(tc.action).new(tc.input, options)
67+
reader = RDF::Reader.for(tc.action).new(tc.input, **options)
6868

6969
graph = RDF::Repository.new
7070
result = nil
@@ -139,7 +139,7 @@ opts = GetoptLong.new(
139139
["--verbose", "-v", GetoptLong::NO_ARGUMENT]
140140
)
141141

142-
def help(options)
142+
def help(**options)
143143
puts "Usage: #{$0} [options] [test-number ...]"
144144
puts "Options:"
145145
puts " --debug: Display detailed debug output"
@@ -157,7 +157,7 @@ end
157157

158158
opts.each do |opt, arg|
159159
case opt
160-
when '--help' then help(options)
160+
when '--help' then help(**options)
161161
when '--dbg' then options[:level] = Logger::DEBUG
162162
when '--earl'
163163
options[:quiet] = options[:earl] = true
@@ -175,14 +175,14 @@ end
175175

176176
manifest = (options[:ntriples] ? Fixtures::SuiteTest::NTBASE : Fixtures::SuiteTest::BASE) + "manifest.ttl"
177177

178-
earl_preamble(options) if options[:earl]
178+
earl_preamble(**options) if options[:earl]
179179

180180
result_count = {}
181181

182182
Fixtures::SuiteTest::Manifest.open(manifest) do |m|
183183
m.entries.each do |tc|
184184
next unless ARGV.empty? || ARGV.any? {|n| tc.name.match(/#{n}/)}
185-
run_tc(tc, options.merge(result_count: result_count))
185+
run_tc(tc, result_count: result_count, **options)
186186
end
187187
end
188188

0 commit comments

Comments
 (0)